日期:2014-05-18  浏览次数:20360 次

请问这两个trigger在运行结果上有什么不同?
ALTER TRIGGER [trgInterfaceEvents] ON [dbo].[tblEvent]
FOR UPDATE
AS
If Update(IsComplete)
BEGIN
Insert tblInterfaceExport (ExternalId, EventId)
Select I.InterfaceExportID, I.EventId
From Inserted I 
  Join tblInterfaceExport IE ON I.ExternalId = IE.ExternalId and IE.ExternalId is null
where I.IsComplete = 1 and I.SendToInterface = 1 and I.TransferState = 4 
END
请问为什么上面的这个的这个trigger和下面的这trigger会对tblInterfaceExport有什么不同影响? 

ALTER TRIGGER [trgInterfaceEvents] ON [dbo].[tblEvent]
FOR UPDATE
AS
If Update(IsComplete)
BEGIN
Insert tblInterfaceExport (ExternalId, EventId)
Select I.InterfaceExportID, I.EventId
From Inserted I 
  LEFT Join tblInterfaceExport IE ON I.ExternalId = IE.ExternalId  
where I.IsComplete = 1 and I.SendToInterface = 1 and I.TransferState = 4 
  and IE.ExternalId is null
  END

------解决方案--------------------
是的