
@strName varchar(20), --用户输入的参数2
@strMobile varchar(20), --用户输入的参数3
@strRemark nvarchar(200) --用户输入的参数4,最后一个不需要加,
as
declare @ID int --定义变量
declare @Account varchar(50) --同上
declare @Content varchar(50) --同上
if not exists(select * from tblBlackList(nolock) --如果不存在则执行下面的语句.
where fdcMobile=@strMobile)
begin
insert into tblBlackList(fdcMobile,fdcName,fdtTm,fdcMemo)
values(@strMobile,@strName,getdate(),@strRemark) --getdate()获取当前系统的时间
set @ID=@@identity--返回一行记录
select @Account=Account from dbo.UserInfo where UserID=@UserID
set @Content='添加黑名单('+' *** 作者:'+@Account+','+'用户名:'+@strName+'手机:'+@strMobile+'备注:'+@strRemark+')'--设置变量的值
exec ProcRecordLog @Account,'添加',@Content ---执行储过程ProcRecordLog
return @ID
end
GO
这个存储后面调用了ProcRecordLog存储过程
使用SQL语句创建存储的具体过程如下:
1、首先,打开企业管理器,选择【工具】-【查询分析器】:
2、然后,输入SQL语句。如下:
CREATE PROCEDURE byroyalty1 @percentage int
AS
select au_id from titleauthor
where titleauthor.royaltyper = @percentage
GO
3、然后,点击确定之后,命令就会自动添加进查询中:
4、然后执行一下刚输入的命令:
5、最后,就可以在d出的小窗口中查看存储过程了:
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)