首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

怎么创建函数?为啥小弟我这段代码有异常

2012-01-12 
如何创建函数?为啥我这段代码有错误?SQL codecreate function hello2(@ix int,@iy int)return int isdecla

如何创建函数?为啥我这段代码有错误?

SQL code
create function hello2(@ix int,@iy int)return int isdeclare @temp int;if (@ix > @iy)begin @temp = @ixendelsebegin@temp = @iyendreturn @temp


[解决办法]
探讨

引用:

create function hello2(@ix int,@iy int)
return int
is
declare @temp int;
if (@ix > @iy)
begin
set @temp = @ix
end
else
begin
set @temp = @iy
end
return @temp


还是……

[解决办法]
create function hello2(@ix int,@iy int)
returns int
as
begindeclare @temp int;
if (@ix > @iy)
begin
set @temp = @ix
end
else
begin
set @temp = @iy
end
return @temp
end

热点排行