delete
as
if @@rowcount=0
return
if @@rowcount>1
begin
rollback transaction
raiserror('you can only delete one information at one time',16,1)
end
return
drop trigger deltrigger
go
create trigger deltrigger on tb after
delete
as
if @@rowcount=0
return
if ( select count(*) from deleted )>1
begin
rollback transaction
raiserror('you can only delete one information at one time',16,1)
end
改成这个吧,不知道你那个为什么不行
create trigger deltrigger on tb after
delete
as
declare @count int
set @count=@@rowcount
if @@rowcount=0
return
if @count>1
begin
rollback transaction
raiserror('you can only delete one information at one time',16,1)
end
这样也行.可能是@@rowcount的使用有限制吧,具体的我也不清楚