if (exists (select * from sysobjects where xtype='tr' and name='trig'))
drop trigger trig1
go
create trigger trig1 on 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))
end
我为我的一个表创建的触发器。基本上它涉及2张桌子。一种是“proiecte”(项目),另一种是“participari”(参与)。项目表包含项目 ID、项目名称和截止日期。参与有项目id(外国),参与者的名字,从和到(时间间隔,每个标记2个不同的列)。它最后给了我一个错误,一个语法错误,我无法理解它。谁能帮我吗?