如何创建函数?为啥我这段代码有错误?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) returns int as begindeclare @temp int; if (@ix > @iy) begin set @temp = @ix end else begin set @temp = @iy end return @temp end