Back to OIM Explorer

dbo.RMS_TIESetHasEntitlement

Database TriggerSQL_TRIGGERSandbox DB

Database Trigger on ESetHasEntitlement. Bulk DBQueue insert -> RMS-K-ESetHasEntitlement / RMS_ZESetHasEntitlement at line 9; Bulk DBQueue insert -> <Key><T> at line 9; Bulk DBQueue insert -> <Key><T> at line 9; Bulk DBQueue insert -> if exists (select top 1 1 from @Tabelle@ x with (readpast) where x.XObjectKey = '@Entitlement@' and dbo.QER_FGIITShopFlagCombineValid( '@ObjectkeyESet@ at line 9

Source: sandbox-db sys.sql_modules

Source size: 7.398 characters

Interpretation

  • Database trigger. Treat parent table and enqueue/object-layer calls as the main relation points.
  • DBQueue relation detected. Follow the task procedure and referenced-by list for async processing.

Relations

  • Bulk DBQueue insert -> RMS-K-ESetHasEntitlement / RMS_ZESetHasEntitlement at line 9
  • Bulk DBQueue insert -> <Key><T> at line 9
  • Bulk DBQueue insert -> <Key><T> at line 9
  • Bulk DBQueue insert -> if exists (select top 1 1 from @Tabelle@ x with (readpast) where x.XObjectKey = '@Entitlement@' and dbo.QER_FGIITShopFlagCombineValid( '@ObjectkeyESet@ at line 9
  • Bulk DBQueue insert -> <Key><T> at line 16
  • Bulk DBQueue insert -> <Key><T> at line 16
  • Bulk DBQueue insert -> if exists (select top 1 1 from @Tabelle@ x with (readpast) where x.XObjectKey = '@Entitlement@' and dbo.QER_FGIITShopFlagCombineValid( '@ObjectkeyESet@' , @IsForITShop@ , @IsITShopOnly@ , '@Entitlement@' , @ElementIsForITShop@ , @ElementIsITShopOnly@ ) = 0 ) begin raiserror ('#LDS#Assignment is not permitted due to the combination of IT Shop flags.| at line 16
  • Bulk DBQueue insert -> <Key><T> at line 23
  • Bulk DBQueue insert -> if exists (select top 1 1 from @Tabelle@ x with (readpast) where x.XObjectKey = '@Entitlement@' and dbo.QER_FGIITShopFlagCombineValid( '@ObjectkeyESet@' , @IsForITShop@ , @IsITShopOnly@ , '@Entitlement@' , @ElementIsForITShop@ , @ElementIsITShopOnly@ ) = 0 ) begin raiserror ('#LDS#Assignment is not permitted due to the combination of IT Shop flags.|', 18, 2) with nowait end at line 23
  • Bulk DBQueue insert -> if exists (select top 1 1 from @Tabelle@ x with (readpast) where x.XObjectKey = '@Entitlement@' and dbo.QER_FGIITShopFlagCombineValid( '@ObjectkeyESet@' , @IsForITShop@ , @IsITShopOnly@ , '@Entitlement@' , @ElementIsForITShop@ , @ElementIsITShopOnly@ ) = 0 ) begin raiserror ('#LDS#Assignment is not permitted due to the combination of IT Shop flags.|', 18, 2) with nowait end at line 30
  • Bulk DBQueue insert -> at line 30
  • Bulk DBQueue insert -> RMS-K-ESetHasEntitlement / RMS_ZESetHasEntitlement at line 57
  • Bulk DBQueue insert -> RMS-K-ESetHasEntitlement / RMS_ZESetHasEntitlement at line 57
  • Bulk DBQueue insert -> RMS-K-ESetHasEntitlement / RMS_ZESetHasEntitlement at line 60
  • References QBM_PDBQueueInsert_Bulk
  • Trigger parent table: ESetHasEntitlement

Typed Edges

  • queues DBQueue task RMS_ZESetHasEntitlement at line 9 Bulk DBQueue insert -> RMS-K-ESetHasEntitlement / RMS_ZESetHasEntitlement at line 9
  • queues DBQueue task <Key><T> at line 9 Bulk DBQueue insert -> <Key><T> at line 9
  • queues DBQueue task if exists (select top 1 1 from @Tabelle@ x with (readpast) where x.XObjectKey = '@Entitlement@' and dbo.QER_FGIITShopFlagCombineValid( '@ObjectkeyESet@ at line 9 Bulk DBQueue insert -> if exists (select top 1 1 from @Tabelle@ x with (readpast) where x.XObjectKey = '@Entitlement@' and dbo.QER_FGIITShopFlagCombineValid( '@ObjectkeyESet@ at line 9
  • queues DBQueue task <Key><T> at line 16 Bulk DBQueue insert -> <Key><T> at line 16
  • queues DBQueue task if exists (select top 1 1 from @Tabelle@ x with (readpast) where x.XObjectKey = '@Entitlement@' and dbo.QER_FGIITShopFlagCombineValid( '@ObjectkeyESet@' , @IsForITShop@ , @IsITShop Bulk DBQueue insert -> if exists (select top 1 1 from @Tabelle@ x with (readpast) where x.XObjectKey = '@Entitlement@' and dbo.QER_FGIITShopFlagCombineValid( '@ObjectkeyESet@' , @IsForITShop@ , @IsITShopOnly@ , '@Entitlement@' , @ElementIsForITShop@ , @ElementIsITShopOnly@ ) = 0
  • queues DBQueue task <Key><T> at line 23 Bulk DBQueue insert -> <Key><T> at line 23
  • queues DBQueue task at line 30 Bulk DBQueue insert -> at line 30
  • queues DBQueue task RMS_ZESetHasEntitlement at line 57 Bulk DBQueue insert -> RMS-K-ESetHasEntitlement / RMS_ZESetHasEntitlement at line 57
  • queues DBQueue task RMS_ZESetHasEntitlement at line 60 Bulk DBQueue insert -> RMS-K-ESetHasEntitlement / RMS_ZESetHasEntitlement at line 60
  • trigger on table ESetHasEntitlement Trigger parent table: ESetHasEntitlement
  • references source dbo.QBM_FCVObjectkeyToElement source text reference
  • references source dbo.QBM_FGIBitPatternXOrigin source text reference
  • references source dbo.QBM_FGIColumnExists source text reference
  • references source dbo.QBM_FGISessionContext source text reference
  • references source dbo.QBM_FGITableName source text reference
  • references source dbo.QER_FGIITShopFlagCombineValid source text reference
  • references source dbo.QBM_PDBQueueInsert_Bulk source text reference
  • references source dbo.QBM_PExecuteSQLMulti source text reference
  • references source dbo.QBM_PSessionErrorAdd source text reference
  • references source dbo.RMS_TIESet source text reference

Complete Source

SQL299 lines
1CREATE trigger RMS_TIESetHasEntitlement2  ON ESetHasEntitlement FOR3INSERT NOT FOR Replication4AS5BEGIN6  DECLARE @EsetOperation varchar(38)7  DECLARE @EsetTable varchar(30)8  DECLARE @ElementLast int9  DECLARE @ElementBufferMulti QBM_YCursorBuffer10  DECLARE @ElementCount int11  DECLARE @ElementIndex int12  DECLARE @SQLCmd nvarchar(max)13  DECLARE @Entitlement varchar(138),14  @ObjectkeyESet varchar(138)15  DECLARE @Pattern nvarchar(max)16  DECLARE @DebugSwitch int = 017  DECLARE @QBM_BitPatternXOrigin_Inherit_inv int = dbo.QBM_FGIBitPatternXOrigin('|Inherit|',18  1)19  DECLARE @DBQueueElements_spezial QBM_YDBQueueRaw20  DECLARE @UID_TaskFollow varchar(38)21  BEGIN TRY22    IF EXISTS(23      SELECT TOP 1 124      FROM inserted)25    GOTO start26    RETURN start:27    DECLARE @GenProcID varchar(38)28    SELECT @GenProcID = dbo.QBM_FGISessionContext('')29    IF EXISTS(30      SELECT TOP 1 131      FROM inserted i32    LEFT33    OUTER34      JOIN BaseTreeAssign a35        ON i.Entitlement LIKE '<Key><T>' + dbo.QBM_FGITableName(a.UID_DialogTableElement) + '</T>%' AND a.IsEsetEnabled = 136    WHERE37      a.UID_BaseTreeAssign IS NULL)38    BEGIN39      RAISERROR('#LDS#Assignment cannot be made because the assigned Element is not permittet for assignments to system roles.|',40      18,41      2)42        WITH nowait43    END44    DECLARE @DBQueueElements_01 QBM_YDBQueueRaw45    INSERT INTO @DBQueueElements_01(object,46    subobject,47    genprocid)48    SELECT49      x.uid,50      NULL,51      @GenProcID52    FROM(53    SELECT54      DISTINCT i.UID_ESet AS uid55    FROM inserted i56    WHERE57      i.XOrigin & @QBM_BitPatternXOrigin_Inherit_inv > 0) AS x58    EXEC QBM_PDBQueueInsert_Bulk 'RMS-K-ESetHasEntitlement',59      @DBQueueElements_0160    DELETE @ElementBufferMulti61    INSERT INTO @ElementBufferMulti(UID1,62    Ident1)63    SELECT64      DISTINCT v.UID_TaskBaseTree,65      t.TableName66    FROM inserted i67    JOIN DialogTable t68      ON i.Entitlement LIKE '<Key><T>' + t.TableName + '</T>%'69    JOIN BaseTreeAssign v70      ON t.UID_DialogTable = v.UID_DialogTableElement71    WHERE72      v.UID_TaskBaseTree > ' ' AND i.XIsInEffect = 173    SELECT @ElementCount = @@ROWCOUNT74    SELECT @ElementIndex = @@IDENTITY - @ElementCount +175    SELECT @ElementLast = @@IDENTITY76    WHILE @ElementIndex <= @ElementLast77    BEGIN78      SELECT79        TOP 1 @EsetOperation = bu.UID1,80        @EsetTable = bu.Ident181      FROM @ElementBufferMulti bu82      WHERE83        bu.ElementIndex = @ElementIndex84      DELETE @DBQueueElements_spezial85      INSERT INTO @DBQueueElements_spezial(object,86      subobject,87      genprocid)88      SELECT89        x.uid,90        NULL,91        @GenProcID92      FROM(93      SELECT94        DISTINCT ehe.uid_org AS uid95      FROM inserted i96      JOIN BaseTreehaseset ehe97        ON i.uid_ESet = ehe.uid_ESet AND ehe.XOrigin > 098      WHERE99        i.Entitlement LIKE '<Key><T>' + @EsetTable + '</T>%') AS x100      EXEC QBM_PDBQueueInsert_Bulk @EsetOperation,101        @DBQueueElements_spezial102      SELECT @ElementIndex += 1103    END104    DELETE @ElementBufferMulti105    INSERT INTO @ElementBufferMulti(UID1,106    Ident1)107    SELECT108      DISTINCT v.UID_TaskPerson,109      t.TableName110    FROM inserted i111    JOIN DialogTable t112      ON i.Entitlement LIKE '<Key><T>' + t.TableName + '</T>%'113    JOIN BaseTreeAssign v114      ON t.UID_DialogTable = v.UID_DialogTableElement115    WHERE116      v.UID_TaskPerson > ' ' AND i.XIsInEffect = 1117    SELECT @ElementCount = @@ROWCOUNT118    SELECT @ElementIndex = @@IDENTITY - @ElementCount +1119    SELECT @ElementLast = @@IDENTITY120    WHILE @ElementIndex <= @ElementLast121    BEGIN122      SELECT123        TOP 1 @EsetOperation = bu.UID1,124        @EsetTable = bu.Ident1125      FROM @ElementBufferMulti bu126      WHERE127        bu.ElementIndex = @ElementIndex128      DELETE @DBQueueElements_spezial129      INSERT INTO @DBQueueElements_spezial(object,130      subobject,131      genprocid)132      SELECT133        x.uid,134        NULL,135        @GenProcID136      FROM(137      SELECT138        DISTINCT ehe.UID_Person AS uid139      FROM inserted i140      JOIN PersonHasESet ehe141        ON i.uid_ESet = ehe.uid_ESet AND ehe.XOrigin > 0142      WHERE143        i.Entitlement LIKE '<Key><T>' + @EsetTable + '</T>%') AS x144      EXEC QBM_PDBQueueInsert_Bulk @EsetOperation,145        @DBQueueElements_spezial146      SELECT @ElementIndex += 1147    END148    DELETE @ElementBufferMulti149    INSERT INTO @ElementBufferMulti(UID1,150    Ident1)151    SELECT152      DISTINCT v.UID_TaskWorkDesk,153      t.TableName154    FROM inserted i155    JOIN DialogTable t156      ON i.Entitlement LIKE '<Key><T>' + t.TableName + '</T>%'157    JOIN BaseTreeAssign v158      ON t.UID_DialogTable = v.UID_DialogTableElement159    WHERE160      v.UID_TaskWorkDesk > ' ' AND i.XIsInEffect = 1161    SELECT @ElementCount = @@ROWCOUNT162    SELECT @ElementIndex = @@IDENTITY - @ElementCount +1163    SELECT @ElementLast = @@IDENTITY164    WHILE @ElementIndex <= @ElementLast165    BEGIN166      SELECT167        TOP 1 @EsetOperation = bu.UID1,168        @EsetTable = bu.Ident1169      FROM @ElementBufferMulti bu170      WHERE171        bu.ElementIndex = @ElementIndex172      DELETE @DBQueueElements_spezial173      INSERT INTO @DBQueueElements_spezial(object,174      subobject,175      genprocid)176      SELECT177        x.uid,178        NULL,179        @GenProcID180      FROM(181      SELECT182        DISTINCT ehe.UID_WorkDesk AS uid183      FROM inserted i184      JOIN WorkDeskHasESet ehe185        ON i.uid_ESet = ehe.uid_ESet AND ehe.XOrigin > 0186      WHERE187        i.Entitlement LIKE '<Key><T>' + @EsetTable + '</T>%') AS x188      EXEC QBM_PDBQueueInsert_Bulk @EsetOperation,189        @DBQueueElements_spezial190      SELECT @ElementIndex += 1191    END192    SELECT193      @Pattern = '194 if exists (select top 1 1195				from @Tabelle@ x with (readpast)196				where x.XObjectKey = ''@Entitlement@''197				and dbo.QER_FGIITShopFlagCombineValid(198														''@ObjectkeyESet@''199														, @IsForITShop@200														, @IsITShopOnly@201														, ''@Entitlement@''202														, @ElementIsForITShop@203														, @ElementIsITShopOnly@204													) = 0205			)206	begin207		raiserror (''#LDS#Assignment is not permitted due to the combination of IT Shop flags.|'', 18, 2) with nowait208	end209	'210    DELETE @ElementBufferMulti211    INSERT INTO @ElementBufferMulti(ObjectKey1,212    ObjectKey2,213    ContentFull)214    SELECT215      e.XObjectKey,216      i.Entitlement,217      replace(replace(replace(replace(replace(replace(replace(@Pattern, '@tabelle@', dbo.QBM_FCVObjectkeyToElement('TableName',218      i.Entitlement)), '@Entitlement@', i.Entitlement), '@ObjectkeyESet@', e.XObjectKey), '@IsForITShop@', str(e.IsForITShop)),219      '@IsITShopOnly@', str(e.IsITShopOnly)), '@ElementIsForITShop@', CASE dbo.QBM_FGIColumnExists(dbo.QBM_FCVObjectkeyToElement('TableName',220      i.Entitlement), 'IsForITShop')221      WHEN 1 THEN222      'x.IsForITShop'223    ELSE '0'224    END),225    '@ElementIsITShopOnly@',226    CASE dbo.QBM_FGIColumnExists(dbo.QBM_FCVObjectkeyToElement('TableName', i.Entitlement), 'IsITShopOnly')227      WHEN 1 THEN228    'x.IsITShopOnly'229    ELSE '0'230    END)231    FROM inserted i232    JOIN ESet e233      ON i.UID_ESet = e.UID_ESet234    SELECT @ElementCount = @@ROWCOUNT235    IF @ElementCount > 0236    BEGIN237      EXEC QBM_PExecuteSQLMulti @ElementBufferMulti238    END239    DECLARE @DBQueueElements_03 QBM_YDBQueueRaw240    INSERT INTO @DBQueueElements_03(object,241    subobject,242    genprocid)243    SELECT244      x.uid,245      NULL,246      @GenProcID247    FROM(248    SELECT d.UID_ESet AS uid249    FROM inserted d250    WHERE251      d.XIsInEffect = 1252    UNION253    SELECT p.UID_ESet AS uid254    FROM inserted d255    JOIN Eset p256      ON d.Entitlement = p.XObjectKey257    WHERE258      d.XIsInEffect = 1259    UNION260    SELECT ehe.uid_ESet261    FROM inserted d262    JOIN ESet p263      ON d.Entitlement = p.XObjectKey264    JOIN EsetHasEntitlement ehe265      ON ehe.Entitlement = p.XObjectKey AND ehe.XOrigin > 0266    WHERE267      d.XIsInEffect = 1) AS x268    SELECT @UID_TaskFollow = 'RMS-K-ESetCollection'269    EXEC QBM_PDBQueueInsert_Bulk @UID_TaskFollow,270      @DBQueueElements_03271    DECLARE @DBQueueElements_02 QBM_YDBQueueRaw272    INSERT INTO @DBQueueElements_02(object,273    subobject,274    genprocid)275    SELECT276      x.uid,277      NULL,278      @GenProcID279    FROM(280    SELECT281      DISTINCT ec.UID_ESet AS uid282    FROM inserted d283    JOIN ESetCollection ec284      ON d.uid_ESet = ec.UID_EsetChild285    WHERE286      d.XIsInEffect = 1) AS x287    EXEC QBM_PDBQueueInsert_Bulk 'RMS-K-ESetHasEntitlement',288      @DBQueueElements_02289  END TRY290  BEGIN CATCH291    EXEC QBM_PSessionErrorAdd DEFAULT292    RAISERROR('',293    18,294    1)295      WITH NOWAIT296  END CATCH297  ende:298  RETURN299END
Open raw exported source
SQL ยท Raw62 lines
1  create   trigger RMS_TIESetHasEntitlement on ESetHasEntitlement  for Insert not for Replication as begin declare @EsetOperation varchar(38) declare2 @EsetTable varchar(30) declare @ElementLast int declare @ElementBufferMulti QBM_YCursorBuffer declare @ElementCount int declare @ElementIndex int declare3 @SQLCmd nvarchar(max) declare @Entitlement varchar(138) , @ObjectkeyESet varchar(138) declare @Pattern nvarchar(max) declare @DebugSwitch int = 0 declare4 @QBM_BitPatternXOrigin_Inherit_inv int = dbo.QBM_FGIBitPatternXOrigin('|Inherit|', 1) declare @DBQueueElements_spezial QBM_YDBQueueRaw declare @UID_TaskFollow5 varchar(38) BEGIN TRY if exists (select top 1 1 from inserted) goto start return start: declare @GenProcID varchar(38) select @GenProcID = dbo.QBM_FGISessionContext6('')   if exists (select top 1 1 from inserted i left outer join BaseTreeAssign a on  i.Entitlement like '<Key><T>' + dbo.QBM_FGITableName(a.UID_DialogTableElement7) + '</T>%' and a.IsEsetEnabled = 1 where a.UID_BaseTreeAssign is null ) begin raiserror( '#LDS#Assignment cannot be made because the assigned Element is not permittet for assignments to system roles.|'8, 18, 2) with nowait end declare @DBQueueElements_01 QBM_YDBQueueRaw insert into @DBQueueElements_01 (object, subobject, genprocid) select x.uid, null,9 @GenProcID from ( select distinct i.UID_ESet as uid from inserted i  where i.XOrigin & @QBM_BitPatternXOrigin_Inherit_inv > 0  ) as x exec QBM_PDBQueueInsert_Bulk10 'RMS-K-ESetHasEntitlement', @DBQueueElements_01   delete  @ElementBufferMulti insert into @ElementBufferMulti(UID1, Ident1) select distinct v.UID_TaskBaseTree11, t.TableName from inserted i join DialogTable t on  i.Entitlement like '<Key><T>' + t.TableName + '</T>%' join BaseTreeAssign v on t.UID_DialogTable =12 v.UID_DialogTableElement where v.UID_TaskBaseTree > ' ' and i.XIsInEffect = 1 select @ElementCount = @@ROWCOUNT select @ElementIndex = @@IDENTITY - @ElementCount13 +1 select @ElementLast = @@IDENTITY while @ElementIndex <= @ElementLast begin select top 1 @EsetOperation = bu.UID1 , @EsetTable = bu.Ident1 from @ElementBufferMulti14 bu where bu.ElementIndex = @ElementIndex   delete  @DBQueueElements_spezial insert into @DBQueueElements_spezial (object, subobject, genprocid) select15 x.uid, null, @GenProcID from ( select distinct ehe.uid_org as uid from inserted i join BaseTreehaseset ehe on i.uid_ESet = ehe.uid_ESet and ehe.XOrigin16 > 0  where  i.Entitlement like '<Key><T>' + @EsetTable + '</T>%' ) as x exec QBM_PDBQueueInsert_Bulk @EsetOperation, @DBQueueElements_spezial select @ElementIndex17 += 1 end   delete  @ElementBufferMulti insert into @ElementBufferMulti(UID1, Ident1) select distinct v.UID_TaskPerson, t.TableName from inserted i join18 DialogTable t on  i.Entitlement like '<Key><T>' + t.TableName + '</T>%' join BaseTreeAssign v on t.UID_DialogTable = v.UID_DialogTableElement where v.UID_TaskPerson19 > ' ' and i.XIsInEffect = 1 select @ElementCount = @@ROWCOUNT select @ElementIndex = @@IDENTITY - @ElementCount +1 select @ElementLast = @@IDENTITY while20 @ElementIndex <= @ElementLast begin select top 1 @EsetOperation = bu.UID1 , @EsetTable = bu.Ident1 from @ElementBufferMulti bu where bu.ElementIndex =21 @ElementIndex   delete  @DBQueueElements_spezial insert into @DBQueueElements_spezial (object, subobject, genprocid) select x.uid, null, @GenProcID from22 ( select distinct ehe.UID_Person as uid from inserted i join PersonHasESet ehe on i.uid_ESet = ehe.uid_ESet and ehe.XOrigin > 0  where  i.Entitlement 23like '<Key><T>' + @EsetTable + '</T>%' ) as x exec QBM_PDBQueueInsert_Bulk @EsetOperation, @DBQueueElements_spezial select @ElementIndex += 1 end   delete24  @ElementBufferMulti insert into @ElementBufferMulti (UID1, Ident1) select distinct v.UID_TaskWorkDesk, t.TableName from inserted i join DialogTable t25 on  i.Entitlement like '<Key><T>' + t.TableName + '</T>%' join BaseTreeAssign v on t.UID_DialogTable = v.UID_DialogTableElement where v.UID_TaskWorkDesk26 > ' ' and i.XIsInEffect = 1 select @ElementCount = @@ROWCOUNT select @ElementIndex = @@IDENTITY - @ElementCount +1 select @ElementLast = @@IDENTITY while27 @ElementIndex <= @ElementLast begin select top 1 @EsetOperation = bu.UID1 , @EsetTable = bu.Ident1 from @ElementBufferMulti bu where bu.ElementIndex =28 @ElementIndex   delete  @DBQueueElements_spezial insert into @DBQueueElements_spezial (object, subobject, genprocid) select x.uid, null, @GenProcID from29 ( select distinct ehe.UID_WorkDesk as uid from inserted i join WorkDeskHasESet ehe on i.uid_ESet = ehe.uid_ESet and ehe.XOrigin > 0  where  i.Entitlement30 like '<Key><T>' + @EsetTable + '</T>%' ) as x exec QBM_PDBQueueInsert_Bulk @EsetOperation, @DBQueueElements_spezial select @ElementIndex += 1 end   select31 @Pattern = '32 if exists (select top 1 133				from @Tabelle@ x with (readpast)34				where x.XObjectKey = ''@Entitlement@''35				and dbo.QER_FGIITShopFlagCombineValid(36														''@ObjectkeyESet@''37														, @IsForITShop@38														, @IsITShopOnly@39														, ''@Entitlement@''40														, @ElementIsForITShop@41														, @ElementIsITShopOnly@42													) = 043			)44	begin45		raiserror (''#LDS#Assignment is not permitted due to the combination of IT Shop flags.|'', 18, 2) with nowait46	end47	'48  delete  @ElementBufferMulti insert into @ElementBufferMulti(ObjectKey1, ObjectKey2, ContentFull) select e.XObjectKey, i.Entitlement , replace(replace49(replace(replace(replace(replace(replace(@Pattern , '@tabelle@', dbo.QBM_FCVObjectkeyToElement('TableName', i.Entitlement)) , '@Entitlement@', i.Entitlement50) , '@ObjectkeyESet@', e.XObjectKey) , '@IsForITShop@', str(e.IsForITShop)) , '@IsITShopOnly@', str(e.IsITShopOnly)) , '@ElementIsForITShop@', case dbo.QBM_FGIColumnExists51( dbo.QBM_FCVObjectkeyToElement('TableName', i.Entitlement), 'IsForITShop' ) when 1 then 'x.IsForITShop' else '0' end ) , '@ElementIsITShopOnly@', case52 dbo.QBM_FGIColumnExists( dbo.QBM_FCVObjectkeyToElement('TableName', i.Entitlement), 'IsITShopOnly' ) when 1 then 'x.IsITShopOnly' else '0' end )  from53 inserted i join ESet e on i.UID_ESet = e.UID_ESet select @ElementCount = @@ROWCOUNT if @ElementCount > 0 begin exec QBM_PExecuteSQLMulti @ElementBufferMulti54 end declare @DBQueueElements_03 QBM_YDBQueueRaw insert into @DBQueueElements_03 (object, subobject, genprocid) select x.uid, null, @GenProcID from ( select55 d.UID_ESet as uid from inserted d  where d.XIsInEffect = 1 union select p.UID_ESet as uid from inserted d join Eset p on d.Entitlement = p.XObjectKey 56where d.XIsInEffect = 1 union select ehe.uid_ESet from inserted d join ESet p on d.Entitlement = p.XObjectKey join EsetHasEntitlement ehe on ehe.Entitlement57 = p.XObjectKey and ehe.XOrigin > 0  where d.XIsInEffect = 1 ) as x  select @UID_TaskFollow = 'RMS-K-ESetCollection' exec QBM_PDBQueueInsert_Bulk @UID_TaskFollow58, @DBQueueElements_03  declare @DBQueueElements_02 QBM_YDBQueueRaw insert into @DBQueueElements_02 (object, subobject, genprocid) select x.uid, null, @GenProcID59 from ( select distinct ec.UID_ESet as uid from inserted d join ESetCollection ec on d.uid_ESet = ec.UID_EsetChild where d.XIsInEffect = 1 ) as x exec 60QBM_PDBQueueInsert_Bulk 'RMS-K-ESetHasEntitlement', @DBQueueElements_02 END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH61 NOWAIT END CATCH ende: return end 62