![]() |
---|
CREATE trigger dbo.TR_SYSTEMROLEAPPUSER_UPDATED on dbo.SYSTEMROLEAPPUSER after update not for replication as begin if update(SECURITYMODECODE) or update(BRANCHSITEID) or update(APPUSERID) begin if exists (select top 1 1 from INSERTED) begin declare @CHANGEAGENTID uniqueidentifier select top 1 @CHANGEAGENTID = CHANGEDBYID from INSERTED; declare @CONTEXTCACHE varbinary(128) = CONTEXT_INFO() set CONTEXT_INFO @CHANGEAGENTID; delete from dbo.SITEPERMISSION from INSERTED where SITEPERMISSION.SYSTEMROLEAPPUSERID = INSERTED.ID if @CONTEXTCACHE is not null begin set CONTEXT_INFO @CONTEXTCACHE end; end exec dbo.USP_SITEPERMISSION_UPDATEPERMISSIONS end end |