日期:2013-11-04  浏览次数:20474 次


/**********************************************************************
函数名:GetMaxSqrt(@SqrtType)
参数:@SqrtType定义取值的表
    @MaxSqrtID:前往max(sqrt)+1
前往 数字
power by adpost
email:zrsz@hotmail.com
**********************************************************************/
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