/********************************************************************** 函数名:getmaxsqrt(@sqrttype) 参数:@sqrttype定义取值的表 @maxsqrtid:返回max(sqrt)+1 返回 数字 power by adpost email:[email protected] **********************************************************************/ create function getmaxsqrt(@sqrttype as int) returns int with encryption as begin declare @maxsqrtid as int if(@sqrttype=1) begin select @maxsqrtid = max(categorysqrt) from lxbiz_category end if(@sqrttype=2) begin select @maxsqrtid = max(subclasssqrt) from lxbiz_subclass end if(@maxsqrtid is null) begin select @maxsqrtid = 0 end return @maxsqrtid+1 end