SQL function创建
创建:
create function fct_test(@MyChose varchar(50))
returns varchar(50)
as
begin
declare @strReturn varchar(50)
if(@MyChose = 'OK')
set @strReturn = '选择' + @MyChose
else
set @strReturn = '选择其它'
return @strReturn
end
调用:
select dbo.fct_test('OK')
返回:
选择OK
create function fct_test(@MyChose varchar(50))
returns varchar(50)
as
begin
declare @strReturn varchar(50)
if(@MyChose = 'OK')
set @strReturn = '选择' + @MyChose
else
set @strReturn = '选择其它'
return @strReturn
end
调用:
select dbo.fct_test('OK')
返回:
选择OK