您当前的位置: 首页 >  sql

衣舞晨风

暂无认证

  • 1浏览

    0关注

    1156博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

sql server中自定义函数

衣舞晨风 发布时间:2014-01-08 09:47:06 ,浏览量:1

create function getZHYE(@NM varchar(300)) returns FLOAT as begin Declare @memberName FLOAT set @memberName='0' select @memberName = 字段1 from 表A where 字段2=@NM if @memberName='0' begin set @memberName='0' end else if @memberName !='0' begin set @memberName=@memberName end return @memberName end

小注( 函数作用 ):
1、根据传入的值从表A中查询符合条件(字段2=@NM)的字段1,并返回FLOAT类型的返回值
2、自定义函数删除: drop function 函数名
3、验证自定义函数的方式:  select  数据库中的用户名.getZHYE('13'),其余函数类似。
         Execution error: 'the function name is not a recognized built-in function name'  
关注
打赏
1647422595
查看更多评论
立即登录/注册

微信扫码登录

0.0388s