/**********************************************************************
函数名: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
博客展示了一个SQL加密函数GetMaxSqrt的创建过程。该函数接收参数@SqrtType,根据其取值从不同表中获取最大值,若值为空则设为0,最后返回最大值加1的结果,还给出了函数的相关定义及邮箱信息。
725

被折叠的 条评论
为什么被折叠?



