所以我看到 SQL 有一些表,其中包含可能引用的表中新插入和删除的数据。我没有注意到这样的更新数据表。我目前正在使用触发器,我需要将触发器应用于更新。我怎么做?
USE [examene]
GO
/****** Object: Trigger [dbo].[trig1] Script Date: 6/8/2013 6:48:26 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER trigger [dbo].[trig1] on [dbo].[participari]
after insert,update,delete
as
begin
if (exists (select * from deleted))
rollback
if (exists (select * from inserted,proiecte
where inserted.idpr = proiecte.idpr
and deadline<dela union
select * from inserted,proiecte
where inserted.idpr = proiecte.idpr and inserted.panala>proiecte.deadline))
rollback
end
到目前为止,这是我的触发器