您的位置:首页 > 数据库

SQL取得最大排序数字并累加1的自定义函数

2008-04-27 06:54 232 查看
/**********************************************************************
函数名:GetMaxSqrt(@SqrtType)
参数:@SqrtType定义取值的表
@MaxSqrtID:返回max(sqrt)+1
返回数字
powerbyadpost
email:zrsz@hotmail.com
**********************************************************************/
CREATEFUNCTIONGetMaxSqrt(@SqrtTypeasint)
RETURNSint
WITHENCRYPTION
as
BEGIN
declare@MaxSqrtIDasint
if(@SqrtType=1)
begin
select@MaxSqrtID=max(CategorySqrt)fromLXBIZ_Category
end
if(@SqrtType=2)
begin
SELECT@MaxSqrtID=max(SubClassSqrt)FROMLXBIZ_SubClass
end
if(@MaxSqrtIDisnull)
begin
select@MaxSqrtID=0
end
return@MaxSqrtID+1
END
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: