sql server中,库下只是不允许删除某一张表,触发器怎么写啊
1个回答
展开全部
SQL Server写法:
create trigger del_T on T
insert of delete
as
if exists(select 1 from deleted)
begin
raiserror 50001 N'不可删除'
return
end
go
或用
create trigger del_T on T
for delete
as
if exists(select 1 from deleted)
begin
raiserror 50001 N'不可删除'
rollback tran
end
create trigger del_T on T
insert of delete
as
if exists(select 1 from deleted)
begin
raiserror 50001 N'不可删除'
return
end
go
或用
create trigger del_T on T
for delete
as
if exists(select 1 from deleted)
begin
raiserror 50001 N'不可删除'
rollback tran
end
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询