Back to OIM Explorer

dbo.TSB_ZPersonHasObject

Stored ProcedureSQL_STORED_PROCEDURESandbox DB

Stored Procedure.

Source: sandbox-db sys.sql_modules

Source size: 13.706 characters

Interpretation

  • Database routine. Review parameters, called procedures, DBQueue inserts, and QBM_PJobCreate helper calls before assuming side effects.

Relations

  • No extracted relations.

Typed Edges

  • references source dbo.QBM_FGIBitPatternXMarkedForDel source text reference
  • references source dbo.QBM_FGIConfigparmValue source text reference
  • references source dbo.QER_FCVXOriginToInheritInfo source text reference
  • references source dbo.QER_FGIBitPatternInheritInfo source text reference
  • references source dbo.QBM_PDBQueueCalculateDelta source text reference
  • references source dbo.QBM_PSessionErrorAdd source text reference
  • references source dbo.QER_PPersonHasObjectPostProc source text reference

Complete Source

SQL530 lines
1CREATE PROCEDURE TSB_ZPersonHasObject(2  @SlotNumber int3)4AS5BEGIN6  DECLARE @Sourcedata QBM_YDataForDelta,7  @CountDeltaQantity int,8  @CountDeltaOrigin int9  DECLARE @QER_BitPattern_Inherit_0 int = dbo.QER_FGIBitPatternInheritInfo('|Inherit|',10  0)11  DECLARE @DBQueueCurrent QBM_YDBQueueCurrent12  DECLARE @QBM_BitPatternXMarkedForDel_Delay int = dbo.QBM_FGIBitPatternXMarkedForDel('|Delay|',13  0)14  DECLARE @QER_BitPatternInherit_Direct int = dbo.QER_FGIBitPatternInheritInfo('|Direct|',15  0)16  DECLARE @QER_BitPatternInherit_Master int = dbo.QER_FGIBitPatternInheritInfo('|Master|',17  0)18  DECLARE @IncludeTSBPersonUsesAccount nvarchar(1024) = dbo.QBM_FGIConfigparmValue('QER\ComplianceCheck\IncludeTSBPersonUsesAccount')19  BEGIN TRY20    INSERT INTO @DBQueueCurrent(UID_DialogDBQueue,21    UID_Parameter,22    UID_SubParameter,23    GenProcID)24    SELECT25      UID_DialogDBQueue,26      UID_Parameter,27      UID_SubParameter,28      GenProcID29    FROM QBMDBQueueCurrent cu30      WITH(readpast)31    WHERE32      cu.SlotNumber = @SlotNumber33    IF @@rowcount = 034    BEGIN35      GOTO EndLabel36    END37    INSERT INTO @SourceData(IsUpcommingContent,38    XOriginAfter,39    Element,40    AssignedElement,41    XOriginBefore)42    SELECT43      0,44      0,45      pho.UID_Person,46      pho.ObjectKey,47      pho.InheritInfo48    FROM PersonHasObject pho49    JOIN @DBQueueCurrent x50      ON pho.UID_Person = x.uid_parameter51    WHERE52      pho.ObjectKey LIKE '<Key><T>UNSAccountB</T>%' OR pho.ObjectKey LIKE '<Key><T>UNSGroupB</T>%' OR pho.ObjectKey LIKE '<Key><T>UNSGroupB1</T>%' OR53    pho.ObjectKey LIKE '<Key><T>UNSGroupB2</T>%' OR pho.ObjectKey LIKE '<Key><T>UNSGroupB3</T>%' OR pho.ObjectKey LIKE '<Key><T>TSBAccountDef</T>%'54    INSERT INTO @SourceData(IsUpcommingContent,55    XOriginBefore,56    Element,57    AssignedElement,58    XOriginAfter)59    SELECT60      1,61      0,62      y.uid_person,63      y.XObjectKey,64      @QER_BitPatternInherit_Direct65    FROM UNSAccountB y66    JOIN @DBQueueCurrent x67      ON y.uid_person= x.uid_parameter AND y.UID_Person > ' '68    IF @IncludeTSBPersonUsesAccount = '1'69    BEGIN70      INSERT INTO @SourceData(IsUpcommingContent,71      XOriginBefore,72      Element,73      AssignedElement,74      XOriginAfter)75      SELECT76        1,77        0,78        y.uid_person,79        y.ObjectKeyAccount,80        @QER_BitPattern_Inherit_081      FROM TSBPersonUsesAccount y82      JOIN @DBQueueCurrent x83        ON y.uid_person= x.uid_parameter84      JOIN UNSAccountB a85        ON y.ObjectKeyAccount = a.XObjectKey86    END87    INSERT INTO @SourceData(IsUpcommingContent,88    XOriginBefore,89    Element,90    AssignedElement,91    XOriginAfter)92    SELECT93      1,94      0,95      y.uid_person,96      q.XObjectKey,97      dbo.QER_FCVXOriginToInheritInfo(z.XOrigin)98    FROM UNSAccountB y99    JOIN @DBQueueCurrent x100      ON y.uid_person= x.uid_parameter AND y.UID_Person > ' '101    JOIN UNSAccountBInUNSGroupB z102      ON y.uid_UNSAccountB = z.uid_UNSAccountB AND z.XOrigin > 0 AND z.XIsInEffect = 1103    JOIN UNSGroupB q104      ON q.uid_UNSGroupB = z.uid_UNSGroupB105    WHERE106      z.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay = 0107    UNION all108    SELECT109      1,110      0,111      y.uid_person,112      q.XObjectKey,113      dbo.QER_FCVXOriginToInheritInfo(z.XOrigin)114    FROM UNSAccountB y115    JOIN @DBQueueCurrent x116      ON y.uid_person= x.uid_parameter AND y.UID_Person > ' '117    JOIN UNSAccountBInUNSGroupB1 z118      ON y.uid_UNSAccountB = z.uid_UNSAccountB AND z.XOrigin > 0 AND z.XIsInEffect = 1119    JOIN UNSGroupB1 q120      ON q.uid_UNSGroupB1 = z.uid_UNSGroupB1121    WHERE122      z.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay = 0123    UNION all124    SELECT125      1,126      0,127      y.uid_person,128      q.XObjectKey,129      dbo.QER_FCVXOriginToInheritInfo(z.XOrigin)130    FROM UNSAccountB y131    JOIN @DBQueueCurrent x132      ON y.uid_person= x.uid_parameter AND y.UID_Person > ' '133    JOIN UNSAccountBInUNSGroupB2 z134      ON y.uid_UNSAccountB = z.uid_UNSAccountB AND z.XOrigin > 0 AND z.XIsInEffect = 1135    JOIN UNSGroupB2 q136      ON q.uid_UNSGroupB2 = z.uid_UNSGroupB2137    WHERE138      z.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay = 0139    UNION all140    SELECT141      1,142      0,143      y.uid_person,144      q.XObjectKey,145      dbo.QER_FCVXOriginToInheritInfo(z.XOrigin)146    FROM UNSAccountB y147    JOIN @DBQueueCurrent x148      ON y.uid_person= x.uid_parameter AND y.UID_Person > ' '149    JOIN UNSAccountBInUNSGroupB3 z150      ON y.uid_UNSAccountB = z.uid_UNSAccountB AND z.XOrigin > 0 AND z.XIsInEffect = 1151    JOIN UNSGroupB3 q152      ON q.uid_UNSGroupB3 = z.uid_UNSGroupB3153    WHERE154      z.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay = 0155    INSERT INTO @SourceData(IsUpcommingContent,156    XOriginBefore,157    Element,158    AssignedElement,159    XOriginAfter)160    SELECT161      1,162      0,163      y.uid_person,164      q.XObjectKey,165      dbo.QER_FCVXOriginToInheritInfo(z.XOrigin)166    FROM UNSAccountB y167    JOIN @DBQueueCurrent x168      ON y.uid_person= x.uid_parameter AND y.UID_Person > ' '169    JOIN UNSAccountBHasUNSGroupB z170      ON y.uid_UNSAccountB = z.uid_UNSAccountB AND z.XOrigin > 0 AND z.XIsInEffect = 1171    JOIN UNSGroupB q172      ON q.uid_UNSGroupB = z.uid_UNSGroupB173    WHERE174      z.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay = 0175    UNION all176    SELECT177      1,178      0,179      y.uid_person,180      q.XObjectKey,181      dbo.QER_FCVXOriginToInheritInfo(z.XOrigin)182    FROM UNSAccountB y183    JOIN @DBQueueCurrent x184      ON y.uid_person= x.uid_parameter AND y.UID_Person > ' '185    JOIN UNSAccountBHasUNSGroupB1 z186      ON y.uid_UNSAccountB = z.uid_UNSAccountB AND z.XOrigin > 0 AND z.XIsInEffect = 1187    JOIN UNSGroupB1 q188      ON q.uid_UNSGroupB1 = z.uid_UNSGroupB1189    WHERE190      z.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay = 0191    UNION all192    SELECT193      1,194      0,195      y.uid_person,196      q.XObjectKey,197      dbo.QER_FCVXOriginToInheritInfo(z.XOrigin)198    FROM UNSAccountB y199    JOIN @DBQueueCurrent x200      ON y.uid_person= x.uid_parameter AND y.UID_Person > ' '201    JOIN UNSAccountBHasUNSGroupB2 z202      ON y.uid_UNSAccountB = z.uid_UNSAccountB AND z.XOrigin > 0 AND z.XIsInEffect = 1203    JOIN UNSGroupB2 q204      ON q.uid_UNSGroupB2 = z.uid_UNSGroupB2205    WHERE206      z.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay = 0207    UNION all208    SELECT209      1,210      0,211      y.uid_person,212      q.XObjectKey,213      dbo.QER_FCVXOriginToInheritInfo(z.XOrigin)214    FROM UNSAccountB y215    JOIN @DBQueueCurrent x216      ON y.uid_person= x.uid_parameter AND y.UID_Person > ' '217    JOIN UNSAccountBHasUNSGroupB3 z218      ON y.uid_UNSAccountB = z.uid_UNSAccountB AND z.XOrigin > 0 AND z.XIsInEffect = 1219    JOIN UNSGroupB3 q220      ON q.uid_UNSGroupB3 = z.uid_UNSGroupB3221    WHERE222      z.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay = 0223    IF @IncludeTSBPersonUsesAccount = '1'224    BEGIN225      INSERT INTO @SourceData(IsUpcommingContent,226      XOriginBefore,227      Element,228      AssignedElement,229      XOriginAfter)230      SELECT231        1,232        0,233        y.uid_person,234        q.XObjectKey,235        @QER_BitPattern_Inherit_0236      FROM TSBPersonUsesAccount y237      JOIN @DBQueueCurrent x238        ON y.uid_person = x.uid_parameter239      JOIN UNSAccountB a240        ON y.ObjectKeyAccount = a.XObjectKey241      JOIN UNSAccountBInUNSGroupB z242        ON a.uid_UNSAccountB = z.uid_UNSAccountB AND z.XOrigin > 0 AND z.XIsInEffect = 1243      JOIN UNSGroupB q244        ON q.uid_UNSGroupB = z.uid_UNSGroupB245      WHERE246        z.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay = 0247      UNION all248      SELECT249        1,250        0,251        y.uid_person,252        q.XObjectKey,253        @QER_BitPattern_Inherit_0254      FROM TSBPersonUsesAccount y255      JOIN @DBQueueCurrent x256        ON y.uid_person = x.uid_parameter257      JOIN UNSAccountB a258        ON y.ObjectKeyAccount = a.XObjectKey259      JOIN UNSAccountBInUNSGroupB1 z260        ON a.uid_UNSAccountB = z.uid_UNSAccountB AND z.XOrigin > 0 AND z.XIsInEffect = 1261      JOIN UNSGroupB1 q262        ON q.uid_UNSGroupB1 = z.uid_UNSGroupB1263      WHERE264        z.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay = 0265      UNION all266      SELECT267        1,268        0,269        y.uid_person,270        q.XObjectKey,271        @QER_BitPattern_Inherit_0272      FROM TSBPersonUsesAccount y273      JOIN @DBQueueCurrent x274        ON y.uid_person = x.uid_parameter275      JOIN UNSAccountB a276        ON y.ObjectKeyAccount = a.XObjectKey277      JOIN UNSAccountBInUNSGroupB2 z278        ON a.uid_UNSAccountB = z.uid_UNSAccountB AND z.XOrigin > 0 AND z.XIsInEffect = 1279      JOIN UNSGroupB2 q280        ON q.uid_UNSGroupB2 = z.uid_UNSGroupB2281      WHERE282        z.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay = 0283      UNION all284      SELECT285        1,286        0,287        y.uid_person,288        q.XObjectKey,289        @QER_BitPattern_Inherit_0290      FROM TSBPersonUsesAccount y291      JOIN @DBQueueCurrent x292        ON y.uid_person = x.uid_parameter293      JOIN UNSAccountB a294        ON y.ObjectKeyAccount = a.XObjectKey295      JOIN UNSAccountBInUNSGroupB3 z296        ON a.uid_UNSAccountB = z.uid_UNSAccountB AND z.XOrigin > 0 AND z.XIsInEffect = 1297      JOIN UNSGroupB3 q298        ON q.uid_UNSGroupB3 = z.uid_UNSGroupB3299      WHERE300        z.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay = 0301      INSERT INTO @SourceData(IsUpcommingContent,302      XOriginBefore,303      Element,304      AssignedElement,305      XOriginAfter)306      SELECT307        1,308        0,309        y.uid_person,310        q.XObjectKey,311        @QER_BitPattern_Inherit_0312      FROM TSBPersonUsesAccount y313      JOIN @DBQueueCurrent x314        ON y.uid_person = x.uid_parameter315      JOIN UNSAccountB a316        ON y.ObjectKeyAccount = a.XObjectKey317      JOIN UNSAccountBHasUNSGroupB z318        ON a.uid_UNSAccountB = z.uid_UNSAccountB AND z.XOrigin > 0 AND z.XIsInEffect = 1319      JOIN UNSGroupB q320        ON q.uid_UNSGroupB = z.uid_UNSGroupB321      WHERE322        z.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay = 0323      UNION all324      SELECT325        1,326        0,327        y.uid_person,328        q.XObjectKey,329        @QER_BitPattern_Inherit_0330      FROM TSBPersonUsesAccount y331      JOIN @DBQueueCurrent x332        ON y.uid_person = x.uid_parameter333      JOIN UNSAccountB a334        ON y.ObjectKeyAccount = a.XObjectKey335      JOIN UNSAccountBHasUNSGroupB1 z336        ON a.uid_UNSAccountB = z.uid_UNSAccountB AND z.XOrigin > 0 AND z.XIsInEffect = 1337      JOIN UNSGroupB1 q338        ON q.uid_UNSGroupB1 = z.uid_UNSGroupB1339      WHERE340        z.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay = 0341      UNION all342      SELECT343        1,344        0,345        y.uid_person,346        q.XObjectKey,347        @QER_BitPattern_Inherit_0348      FROM TSBPersonUsesAccount y349      JOIN @DBQueueCurrent x350        ON y.uid_person = x.uid_parameter351      JOIN UNSAccountB a352        ON y.ObjectKeyAccount = a.XObjectKey353      JOIN UNSAccountBHasUNSGroupB2 z354        ON a.uid_UNSAccountB = z.uid_UNSAccountB AND z.XOrigin > 0 AND z.XIsInEffect = 1355      JOIN UNSGroupB2 q356        ON q.uid_UNSGroupB2 = z.uid_UNSGroupB2357      WHERE358        z.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay = 0359      UNION all360      SELECT361        1,362        0,363        y.uid_person,364        q.XObjectKey,365        @QER_BitPattern_Inherit_0366      FROM TSBPersonUsesAccount y367      JOIN @DBQueueCurrent x368        ON y.uid_person = x.uid_parameter369      JOIN UNSAccountB a370        ON y.ObjectKeyAccount = a.XObjectKey371      JOIN UNSAccountBHasUNSGroupB3 z372        ON a.uid_UNSAccountB = z.uid_UNSAccountB AND z.XOrigin > 0 AND z.XIsInEffect = 1373      JOIN UNSGroupB3 q374        ON q.uid_UNSGroupB3 = z.uid_UNSGroupB3375      WHERE376        z.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay = 0377    END378    INSERT INTO @SourceData(IsUpcommingContent,379    XOriginBefore,380    Element,381    AssignedElement,382    XOriginAfter)383    SELECT384      1,385      0,386      y.uid_person,387      z.XObjectKey,388      dbo.QER_FCVXOriginToInheritInfo(y.XOrigin)389    FROM PersonHasTSBAccountDef y390    JOIN @DBQueueCurrent x391      ON y.uid_person= x.uid_parameter AND y.XOrigin > 0 AND y.XIsInEffect = 1392    JOIN TSBAccountDef z393      ON y.UID_TSBAccountDef = z.UID_TSBAccountDef394    WHERE395      z.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay = 0396    INSERT INTO @SourceData(IsUpcommingContent,397    XOriginBefore,398    Element,399    AssignedElement,400    XOriginAfter)401    SELECT402      1,403      0,404      t.Element,405      t.XObjectKey,406      @QER_BitPattern_Inherit_0407    FROM(408    SELECT409      ho.Element,410      p.XObjectKey411    FROM @SourceData ho412    JOIN UNSGroupB g413      ON ho.AssignedElement = g.XObjectKey414    JOIN UNSGroupBCollection co415      ON co.UID_UNSGroupBChild = g.uid_UNSGroupB416    JOIN UNSGroupB p417      ON co.UID_UNSGroupBParent = p.UID_UNSGroupB418    WHERE419      ho.IsUpcommingContent = 1 AND co.UID_UNSGroupBChild <> co.UID_UNSGroupBParent420    UNION421    SELECT422      ho.Element,423      p.XObjectKey424    FROM @SourceData ho425    JOIN UNSGroupB1 g426      ON ho.AssignedElement = g.XObjectKey427    JOIN UNSGroupB1Collection co428      ON co.UID_UNSGroupB1Child = g.uid_UNSGroupB1429    JOIN UNSGroupB1 p430      ON co.UID_UNSGroupB1Parent = p.UID_UNSGroupB1431    WHERE432      ho.IsUpcommingContent = 1 AND co.UID_UNSGroupB1Child <> co.UID_UNSGroupB1Parent433    UNION434    SELECT435      ho.Element,436      p.XObjectKey437    FROM @SourceData ho438    JOIN UNSGroupB2 g439      ON ho.AssignedElement = g.XObjectKey440    JOIN UNSGroupB2Collection co441      ON co.UID_UNSGroupB2Child = g.uid_UNSGroupB2442    JOIN UNSGroupB2 p443      ON co.UID_UNSGroupB2Parent = p.UID_UNSGroupB2444    WHERE445      ho.IsUpcommingContent = 1 AND co.UID_UNSGroupB2Child <> co.UID_UNSGroupB2Parent446    UNION447    SELECT448      ho.Element,449      p.XObjectKey450    FROM @SourceData ho451    JOIN UNSGroupB3 g452      ON ho.AssignedElement = g.XObjectKey453    JOIN UNSGroupB3Collection co454      ON co.UID_UNSGroupB3Child = g.uid_UNSGroupB3455    JOIN UNSGroupB3 p456      ON co.UID_UNSGroupB3Parent = p.UID_UNSGroupB3457    WHERE458      ho.IsUpcommingContent = 1 AND co.UID_UNSGroupB3Child <> co.UID_UNSGroupB3Parent) AS t459    INSERT INTO @SourceData(IsUpcommingContent,460    XOriginBefore,461    Element,462    AssignedElement,463    XOriginAfter)464    SELECT465      1,466      0,467      m.uid_person,468      pho.objectkey,469      @QER_BitPatternInherit_Master470    FROM @DBQueueCurrent x471    JOIN person m472      ON m.UID_Person = x.uid_parameter473    JOIN person s474      ON s.UID_PersonMasterIdentity = m.uid_Person475    JOIN PersonHasObject pho476      ON pho.uid_person = s.uid_person477    WHERE478      pho.ObjectKey LIKE '<Key><T>UNSAccountB</T>%' OR pho.ObjectKey LIKE '<Key><T>UNSGroupB</T>%' OR pho.ObjectKey LIKE '<Key><T>UNSGroupB1</T>%' OR479    pho.ObjectKey LIKE '<Key><T>UNSGroupB2</T>%' OR pho.ObjectKey LIKE '<Key><T>UNSGroupB3</T>%'480    IF @IncludeTSBPersonUsesAccount = '1'481    BEGIN482      INSERT INTO @SourceData(IsUpcommingContent,483      XOriginBefore,484      Element,485      AssignedElement,486      XOriginAfter)487      SELECT488        1,489        0,490        m.uid_person,491        pho.ObjectKey,492        @QER_BitPatternInherit_Master493      FROM TSBPersonUsesAccount y494      JOIN @DBQueueCurrent x495        ON y.uid_person = x.uid_parameter496      JOIN person m497        ON m.UID_Person = y.uid_person498      JOIN person s499        ON s.UID_PersonMasterIdentity = m.uid_Person500      JOIN PersonHasObject pho501        ON pho.uid_person = s.uid_person502      WHERE503        pho.ObjectKey LIKE '<Key><T>UNSAccountB</T>%' OR pho.ObjectKey LIKE '<Key><T>UNSGroupB</T>%' OR pho.ObjectKey LIKE '<Key><T>UNSGroupB1</T>%' OR504      pho.ObjectKey LIKE '<Key><T>UNSGroupB2</T>%' OR pho.ObjectKey LIKE '<Key><T>UNSGroupB3</T>%'505    END506    berechnen:507    EXEC QBM_PDBQueueCalculateDelta @SourceData,508      @DeltaQuantity = 1,509      @DeltaDelete = 1,510      @DeltaInsert = 1,511      @DeltaOrigin = 1,512      @CountDeltaQantity = @CountDeltaQantity OUTPUT,513      @CountDeltaOrigin = @CountDeltaOrigin OUTPUT,514      @UseIsInEffect = 0,515      @SlotNumber = @SlotNumber,516      @DBQueueCurrentExtern = @DBQueueCurrent517    EXEC QER_PPersonHasObjectPostProc @SlotNumber,518      @CountDeltaOrigin,519      @CountDeltaQantity,520    'TSB-K-PersonHasObject'521  END TRY522  BEGIN CATCH523    EXEC QBM_PSessionErrorAdd DEFAULT524    RAISERROR('',525    18,526    1)527      WITH NOWAIT528  END CATCH529  endLabel:530END
Open raw exported source
SQL ยท Raw86 lines
1      create   procedure TSB_ZPersonHasObject (@SlotNumber int) AS begin declare @Sourcedata QBM_YDataForDelta , @CountDeltaQantity int , @CountDeltaOrigin2 int declare @QER_BitPattern_Inherit_0 int = dbo.QER_FGIBitPatternInheritInfo('|Inherit|', 0) declare @DBQueueCurrent QBM_YDBQueueCurrent declare @QBM_BitPatternXMarkedForDel_Delay3 int = dbo.QBM_FGIBitPatternXMarkedForDel('|Delay|', 0) declare @QER_BitPatternInherit_Direct int = dbo.QER_FGIBitPatternInheritInfo('|Direct|', 0) declare4 @QER_BitPatternInherit_Master int = dbo.QER_FGIBitPatternInheritInfo('|Master|', 0)  declare @IncludeTSBPersonUsesAccount nvarchar(1024) = dbo.QBM_FGIConfigparmValue5('QER\ComplianceCheck\IncludeTSBPersonUsesAccount') BEGIN TRY insert into @DBQueueCurrent(UID_DialogDBQueue, UID_Parameter, UID_SubParameter, GenProcID6) select UID_DialogDBQueue, UID_Parameter, UID_SubParameter, GenProcID from QBMDBQueueCurrent cu with (readpast) where cu.SlotNumber = @SlotNumber if @@rowcount7 = 0 begin goto EndLabel end insert into @SourceData( IsUpcommingContent, XOriginAfter , Element, AssignedElement, XOriginBefore ) select 0, 0 , pho.UID_Person8, pho.ObjectKey, pho.InheritInfo from PersonHasObject pho join @DBQueueCurrent x on pho.UID_Person = x.uid_parameter where pho.ObjectKey like '<Key><T>UNSAccountB</T>%'9 or pho.ObjectKey like '<Key><T>UNSGroupB</T>%' or pho.ObjectKey like '<Key><T>UNSGroupB1</T>%' or pho.ObjectKey like '<Key><T>UNSGroupB2</T>%' or pho.ObjectKey10 like '<Key><T>UNSGroupB3</T>%' or pho.ObjectKey like '<Key><T>TSBAccountDef</T>%'  insert into @SourceData( IsUpcommingContent, XOriginBefore , Element11, AssignedElement, XOriginAfter ) select 1, 0 , y.uid_person, y.XObjectKey, @QER_BitPatternInherit_Direct from UNSAccountB y join @DBQueueCurrent x on 12y.uid_person= x.uid_parameter and y.UID_Person > ' '  if @IncludeTSBPersonUsesAccount = '1' begin insert into @SourceData( IsUpcommingContent, XOriginBefore13 , Element, AssignedElement, XOriginAfter ) select 1, 0 , y.uid_person, y.ObjectKeyAccount, @QER_BitPattern_Inherit_0 from TSBPersonUsesAccount y join 14@DBQueueCurrent x on y.uid_person= x.uid_parameter join UNSAccountB a on y.ObjectKeyAccount = a.XObjectKey end  insert into @SourceData( IsUpcommingContent15, XOriginBefore , Element, AssignedElement, XOriginAfter ) select 1, 0 , y.uid_person, q.XObjectKey, dbo.QER_FCVXOriginToInheritInfo(z.XOrigin) from UNSAccountB16 y join @DBQueueCurrent x on y.uid_person= x.uid_parameter and y.UID_Person > ' ' join UNSAccountBInUNSGroupB z on y.uid_UNSAccountB = z.uid_UNSAccountB17 and z.XOrigin > 0 and z.XIsInEffect = 1  join UNSGroupB q on q.uid_UNSGroupB = z.uid_UNSGroupB where z.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay18 = 0 union all select 1, 0 , y.uid_person, q.XObjectKey, dbo.QER_FCVXOriginToInheritInfo(z.XOrigin) from UNSAccountB y join @DBQueueCurrent x on y.uid_person=19 x.uid_parameter and y.UID_Person > ' ' join UNSAccountBInUNSGroupB1 z on y.uid_UNSAccountB = z.uid_UNSAccountB and z.XOrigin > 0 and z.XIsInEffect = 120  join UNSGroupB1 q on q.uid_UNSGroupB1 = z.uid_UNSGroupB1 where z.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay = 0 union all select 1, 0 , 21y.uid_person, q.XObjectKey, dbo.QER_FCVXOriginToInheritInfo(z.XOrigin) from UNSAccountB y join @DBQueueCurrent x on y.uid_person= x.uid_parameter and y.UID_Person22 > ' ' join UNSAccountBInUNSGroupB2 z on y.uid_UNSAccountB = z.uid_UNSAccountB and z.XOrigin > 0 and z.XIsInEffect = 1  join UNSGroupB2 q on q.uid_UNSGroupB223 = z.uid_UNSGroupB2 where z.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay = 0 union all select 1, 0 , y.uid_person, q.XObjectKey, dbo.QER_FCVXOriginToInheritInfo24(z.XOrigin) from UNSAccountB y join @DBQueueCurrent x on y.uid_person= x.uid_parameter and y.UID_Person > ' ' join UNSAccountBInUNSGroupB3 z on y.uid_UNSAccountB25 = z.uid_UNSAccountB and z.XOrigin > 0 and z.XIsInEffect = 1  join UNSGroupB3 q on q.uid_UNSGroupB3 = z.uid_UNSGroupB3 where z.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay26 = 0  insert into @SourceData( IsUpcommingContent, XOriginBefore , Element, AssignedElement, XOriginAfter ) select 1, 0 , y.uid_person, q.XObjectKey, dbo.QER_FCVXOriginToInheritInfo27(z.XOrigin) from UNSAccountB y join @DBQueueCurrent x on y.uid_person= x.uid_parameter and y.UID_Person > ' ' join UNSAccountBHasUNSGroupB z on y.uid_UNSAccountB28 = z.uid_UNSAccountB and z.XOrigin > 0 and z.XIsInEffect = 1  join UNSGroupB q on q.uid_UNSGroupB = z.uid_UNSGroupB where z.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay29 = 0  union all select 1, 0 , y.uid_person, q.XObjectKey, dbo.QER_FCVXOriginToInheritInfo(z.XOrigin) from UNSAccountB y join @DBQueueCurrent x on y.uid_person=30 x.uid_parameter and y.UID_Person > ' ' join UNSAccountBHasUNSGroupB1 z on y.uid_UNSAccountB = z.uid_UNSAccountB and z.XOrigin > 0 and z.XIsInEffect = 311  join UNSGroupB1 q on q.uid_UNSGroupB1 = z.uid_UNSGroupB1 where z.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay = 0 union all select 1, 0 ,32 y.uid_person, q.XObjectKey, dbo.QER_FCVXOriginToInheritInfo(z.XOrigin) from UNSAccountB y join @DBQueueCurrent x on y.uid_person= x.uid_parameter and 33y.UID_Person > ' ' join UNSAccountBHasUNSGroupB2 z on y.uid_UNSAccountB = z.uid_UNSAccountB and z.XOrigin > 0 and z.XIsInEffect = 1  join UNSGroupB2 q 34on q.uid_UNSGroupB2 = z.uid_UNSGroupB2 where z.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay = 0 union all select 1, 0 , y.uid_person, q.XObjectKey35, dbo.QER_FCVXOriginToInheritInfo(z.XOrigin) from UNSAccountB y join @DBQueueCurrent x on y.uid_person= x.uid_parameter and y.UID_Person > ' ' join UNSAccountBHasUNSGroupB336 z on y.uid_UNSAccountB = z.uid_UNSAccountB and z.XOrigin > 0 and z.XIsInEffect = 1  join UNSGroupB3 q on q.uid_UNSGroupB3 = z.uid_UNSGroupB3 where z.XMarkedForDeletion37 & @QBM_BitPatternXMarkedForDel_Delay = 0  if @IncludeTSBPersonUsesAccount = '1' begin insert into @SourceData( IsUpcommingContent, XOriginBefore , Element38, AssignedElement, XOriginAfter ) select 1, 0 , y.uid_person, q.XObjectKey, @QER_BitPattern_Inherit_0 from TSBPersonUsesAccount y join @DBQueueCurrent 39x on y.uid_person = x.uid_parameter join UNSAccountB a on y.ObjectKeyAccount = a.XObjectKey join UNSAccountBInUNSGroupB z on a.uid_UNSAccountB = z.uid_UNSAccountB40 and z.XOrigin > 0 and z.XIsInEffect = 1  join UNSGroupB q on q.uid_UNSGroupB = z.uid_UNSGroupB where z.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay41 = 0 union all select 1, 0 , y.uid_person, q.XObjectKey, @QER_BitPattern_Inherit_0 from TSBPersonUsesAccount y join @DBQueueCurrent x on y.uid_person =42 x.uid_parameter join UNSAccountB a on y.ObjectKeyAccount = a.XObjectKey join UNSAccountBInUNSGroupB1 z on a.uid_UNSAccountB = z.uid_UNSAccountB and z.XOrigin43 > 0 and z.XIsInEffect = 1  join UNSGroupB1 q on q.uid_UNSGroupB1 = z.uid_UNSGroupB1 where z.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay = 440 union all select 1, 0 , y.uid_person, q.XObjectKey, @QER_BitPattern_Inherit_0 from TSBPersonUsesAccount y join @DBQueueCurrent x on y.uid_person = x.uid_parameter45 join UNSAccountB a on y.ObjectKeyAccount = a.XObjectKey join UNSAccountBInUNSGroupB2 z on a.uid_UNSAccountB = z.uid_UNSAccountB and z.XOrigin > 0 and 46z.XIsInEffect = 1  join UNSGroupB2 q on q.uid_UNSGroupB2 = z.uid_UNSGroupB2 where z.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay = 0 union all47 select 1, 0 , y.uid_person, q.XObjectKey, @QER_BitPattern_Inherit_0 from TSBPersonUsesAccount y join @DBQueueCurrent x on y.uid_person = x.uid_parameter48 join UNSAccountB a on y.ObjectKeyAccount = a.XObjectKey join UNSAccountBInUNSGroupB3 z on a.uid_UNSAccountB = z.uid_UNSAccountB and z.XOrigin > 0 and 49z.XIsInEffect = 1  join UNSGroupB3 q on q.uid_UNSGroupB3 = z.uid_UNSGroupB3 where z.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay = 0  insert50 into @SourceData( IsUpcommingContent, XOriginBefore , Element, AssignedElement, XOriginAfter ) select 1, 0 , y.uid_person, q.XObjectKey, @QER_BitPattern_Inherit_051 from TSBPersonUsesAccount y join @DBQueueCurrent x on y.uid_person = x.uid_parameter join UNSAccountB a on y.ObjectKeyAccount = a.XObjectKey join UNSAccountBHasUNSGroupB52 z on a.uid_UNSAccountB = z.uid_UNSAccountB and z.XOrigin > 0 and z.XIsInEffect = 1  join UNSGroupB q on q.uid_UNSGroupB = z.uid_UNSGroupB where z.XMarkedForDeletion53 & @QBM_BitPatternXMarkedForDel_Delay = 0  union all select 1, 0 , y.uid_person, q.XObjectKey, @QER_BitPattern_Inherit_0 from TSBPersonUsesAccount y join54 @DBQueueCurrent x on y.uid_person = x.uid_parameter join UNSAccountB a on y.ObjectKeyAccount = a.XObjectKey join UNSAccountBHasUNSGroupB1 z on a.uid_UNSAccountB55 = z.uid_UNSAccountB and z.XOrigin > 0 and z.XIsInEffect = 1  join UNSGroupB1 q on q.uid_UNSGroupB1 = z.uid_UNSGroupB1 where z.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay56 = 0 union all select 1, 0 , y.uid_person, q.XObjectKey, @QER_BitPattern_Inherit_0 from TSBPersonUsesAccount y join @DBQueueCurrent x on y.uid_person =57 x.uid_parameter join UNSAccountB a on y.ObjectKeyAccount = a.XObjectKey join UNSAccountBHasUNSGroupB2 z on a.uid_UNSAccountB = z.uid_UNSAccountB and z.XOrigin58 > 0 and z.XIsInEffect = 1  join UNSGroupB2 q on q.uid_UNSGroupB2 = z.uid_UNSGroupB2 where z.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay = 590 union all select 1, 0 , y.uid_person, q.XObjectKey, @QER_BitPattern_Inherit_0 from TSBPersonUsesAccount y join @DBQueueCurrent x on y.uid_person = x.uid_parameter60 join UNSAccountB a on y.ObjectKeyAccount = a.XObjectKey join UNSAccountBHasUNSGroupB3 z on a.uid_UNSAccountB = z.uid_UNSAccountB and z.XOrigin > 0 and61 z.XIsInEffect = 1  join UNSGroupB3 q on q.uid_UNSGroupB3 = z.uid_UNSGroupB3 where z.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay = 0 end  insert62 into @SourceData( IsUpcommingContent, XOriginBefore , Element, AssignedElement, XOriginAfter ) select 1, 0 , y.uid_person, z.XObjectKey, dbo.QER_FCVXOriginToInheritInfo63(y.XOrigin) from PersonHasTSBAccountDef y join @DBQueueCurrent x on y.uid_person= x.uid_parameter and y.XOrigin > 0 and y.XIsInEffect = 1  join TSBAccountDef64 z on y.UID_TSBAccountDef = z.UID_TSBAccountDef where z.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay = 0  insert into @SourceData( IsUpcommingContent65, XOriginBefore , Element, AssignedElement, XOriginAfter ) select 1, 0 , t.Element, t.XObjectKey, @QER_BitPattern_Inherit_0 from ( select  ho.Element, 66p.XObjectKey from @SourceData ho join UNSGroupB g on ho.AssignedElement = g.XObjectKey  join UNSGroupBCollection co on co.UID_UNSGroupBChild = g.uid_UNSGroupB67 join UNSGroupB p on co.UID_UNSGroupBParent = p.UID_UNSGroupB where ho.IsUpcommingContent = 1 and co.UID_UNSGroupBChild <> co.UID_UNSGroupBParent  union68 select  ho.Element, p.XObjectKey from @SourceData ho join UNSGroupB1 g on ho.AssignedElement = g.XObjectKey join UNSGroupB1Collection co on co.UID_UNSGroupB1Child69 = g.uid_UNSGroupB1 join UNSGroupB1 p on co.UID_UNSGroupB1Parent = p.UID_UNSGroupB1 where ho.IsUpcommingContent = 1 and co.UID_UNSGroupB1Child <> co.UID_UNSGroupB1Parent70 union select  ho.Element, p.XObjectKey from @SourceData ho join UNSGroupB2 g on ho.AssignedElement = g.XObjectKey join UNSGroupB2Collection co on co.UID_UNSGroupB2Child71 = g.uid_UNSGroupB2 join UNSGroupB2 p on co.UID_UNSGroupB2Parent = p.UID_UNSGroupB2 where ho.IsUpcommingContent = 1 and co.UID_UNSGroupB2Child <> co.UID_UNSGroupB2Parent72 union select  ho.Element, p.XObjectKey from @SourceData ho join UNSGroupB3 g on ho.AssignedElement = g.XObjectKey join UNSGroupB3Collection co on co.UID_UNSGroupB3Child73 = g.uid_UNSGroupB3 join UNSGroupB3 p on co.UID_UNSGroupB3Parent = p.UID_UNSGroupB3 where ho.IsUpcommingContent = 1 and co.UID_UNSGroupB3Child <> co.UID_UNSGroupB3Parent74 ) as t          insert into @SourceData( IsUpcommingContent, XOriginBefore , Element, AssignedElement, XOriginAfter ) select 1, 0 , m.uid_person, pho.objectkey75, @QER_BitPatternInherit_Master from @DBQueueCurrent x join person m on m.UID_Person = x.uid_parameter  join person s on s.UID_PersonMasterIdentity = m.uid_Person76 join PersonHasObject pho on pho.uid_person = s.uid_person where pho.ObjectKey like '<Key><T>UNSAccountB</T>%' or pho.ObjectKey like '<Key><T>UNSGroupB</T>%'77 or pho.ObjectKey like '<Key><T>UNSGroupB1</T>%' or pho.ObjectKey like '<Key><T>UNSGroupB2</T>%' or pho.ObjectKey like '<Key><T>UNSGroupB3</T>%'   if @IncludeTSBPersonUsesAccount78 = '1' begin insert into @SourceData( IsUpcommingContent, XOriginBefore , Element, AssignedElement, XOriginAfter ) select 1, 0 , m.uid_person, pho.ObjectKey79, @QER_BitPatternInherit_Master from TSBPersonUsesAccount y join @DBQueueCurrent x on y.uid_person = x.uid_parameter join person m on m.UID_Person = y.uid_person80 join person s on s.UID_PersonMasterIdentity = m.uid_Person join PersonHasObject pho on pho.uid_person = s.uid_person where pho.ObjectKey like '<Key><T>UNSAccountB</T>%'81 or pho.ObjectKey like '<Key><T>UNSGroupB</T>%' or pho.ObjectKey like '<Key><T>UNSGroupB1</T>%' or pho.ObjectKey like '<Key><T>UNSGroupB2</T>%' or pho.ObjectKey82 like '<Key><T>UNSGroupB3</T>%' end   berechnen: exec QBM_PDBQueueCalculateDelta @SourceData, @DeltaQuantity = 1, @DeltaDelete = 1, @DeltaInsert = 1, @DeltaOrigin83 = 1, @CountDeltaQantity = @CountDeltaQantity output , @CountDeltaOrigin = @CountDeltaOrigin output , @UseIsInEffect = 0 , @SlotNumber = @SlotNumber , 84@DBQueueCurrentExtern = @DBQueueCurrent exec QER_PPersonHasObjectPostProc @SlotNumber , @CountDeltaOrigin , @CountDeltaQantity , 'TSB-K-PersonHasObject'85 END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH endLabel: end 86