日期:2014-05-18 浏览次数:20518 次
create proc Operation_Add ----添加日志 @AdminId int, @Content varchar(200) as insert into Operation (AdminId,Content) values (@AdminId,@Content) ALTER proc User_DeleteById --删除用户 ( @Id int, @AdminIds int ) as declare @Contents varchar(200) set @Contents=('删除了用户:'+(select Name from Users where Id=@Id)) exec Operation_Add @AdminId=@AdminIds, @Content=@Contents delete from Users where Id=@Id return 1
ALTER proc User_DeleteById --删除用户 ( @Id int, @AdminIds int ) as declare @Contents varchar(200) select @Contents='删除了用户:'+Name from Users where Id=@Id insert into Operation (AdminId,Content) values (@AdminIds,@Contents) delete from Users where Id=@Id
------解决方案--------------------
select Name from Users where Id=@Id
这句有Bug,如果返回多笔数据,也会报错,加Top 1