![]() |
---|
create trigger TR_SALESORDERALERTEMAILSUBSCRIPTION_DELETESUBSCRIPTION on dbo.SALESORDERALERTEMAILSUBSCRIPTION after delete not for replication as begin set nocount on; declare @CHANGEAGENTID uniqueidentifier exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output; /* cache current context information */ declare @contextCache varbinary(128); set @contextCache = CONTEXT_INFO(); /* set CONTEXT_INFO to @CHANGEAGENTID */ if not @CHANGEAGENTID is null set CONTEXT_INFO @CHANGEAGENTID delete dbo.SALESORDERALERTCONFIGURATION where exists(select 1 from deleted where SALESORDERALERTCONFIGURATION.ID = deleted.SALESORDERALERTCONFIGURATIONID) delete dbo.SALESORDERALERTEMAILADDRESS where exists(select 1 from deleted where SALESORDERALERTEMAILADDRESS.ID = deleted.SALESORDERALERTEMAILADDRESSID) /* reset CONTEXT_INFO to previous value */ if not @contextCache is null set CONTEXT_INFO @contextCache end |