Back to OIM Explorer

dbo.LDP_ZLDPMachineInLDAPGroup

Stored ProcedureSQL_STORED_PROCEDURESandbox DB

Stored Procedure.

Source: sandbox-db sys.sql_modules

Source size: 8.484 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.DPR_FGIProjectionRootRunning source text reference
  • references source dbo.QBM_FGIBitPatternXMarkedForDel source text reference
  • references source dbo.QBM_FGIBitPatternXOrigin source text reference
  • references source dbo.QBM_FGIConfigparmValue source text reference
  • references source dbo.QBM_FGIModuleExists source text reference
  • references source dbo.DPR_PSlotResetWhileProj_L source text reference
  • references source dbo.QBM_PDBQueueCalculateDelta source text reference
  • references source dbo.QBM_PMNTableInsert source text reference
  • references source dbo.QBM_PMNTableOriginUpdate source text reference
  • references source dbo.QBM_PSessionErrorAdd source text reference

Complete Source

SQL331 lines
1CREATE PROCEDURE LDP_ZLDPMachineInLDAPGroup(2  @SlotNumber int3)4AS5BEGIN6  DECLARE @Sourcedata QBM_YDataForDelta,7  @CountDeltaQantity int,8  @CountDeltaOrigin int9  DECLARE @GenProcID varchar(38)10  DECLARE @DBQueueCurrent QBM_YDBQueueCurrent11  DECLARE @ObjectKeysToCheck_Projection QBM_YParameterList12  DECLARE @RowsToReset int13  DECLARE @MyName nvarchar(64) = object_name(@@procid)14  DECLARE @QBM_BitPatternXMarkedForDel_Delay int = dbo.QBM_FGIBitPatternXMarkedForDel('|Delay|',15  0)16  DECLARE @QBM_BitPatternXOrigin_Inherit int = dbo.QBM_FGIBitPatternXOrigin('|Inherit|',17  0)18  DECLARE @QBM_BitPatternXOrigin_Inherit_inv int = dbo.QBM_FGIBitPatternXOrigin('|Inherit|',19  1)20  BEGIN TRY21    INSERT INTO @DBQueueCurrent(UID_DialogDBQueue,22    UID_Parameter,23    UID_SubParameter,24    GenProcID)25    SELECT26      UID_DialogDBQueue,27      UID_Parameter,28      UID_SubParameter,29      GenProcID30    FROM QBMDBQueueCurrent cu31      WITH(readpast)32    WHERE33      cu.SlotNumber = @SlotNumber34    IF @@rowcount = 035    BEGIN36      GOTO EndLabel37    END38    INSERT INTO @SourceData(IsUpcommingContent,39    XOriginAfter,40    Element,41    AssignedElement,42    XOriginBefore,43    XIsInEffectBefore,44    XIsInEffectAfter)45    SELECT46      0,47      0,48      aig.UID_LDPMachine,49      aig.UID_LDAPGroup,50      aig.XOrigin,51      aig.XIsInEffect,52      053    FROM @DBQueueCurrent x54    JOIN LDPMachineInLDAPGroup aig55      ON aig.UID_LDPMachine = x.uid_parameter56    JOIN LDAPGroup g57      ON aig.uid_LDAPGroup = g.uid_LDAPgroup AND g.IsDynamicGroup = 058    WHERE59      aig.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay = 060    INSERT INTO @SourceData(IsUpcommingContent,61    XOriginBefore,62    XOriginAfter,63    Element,64    AssignedElement,65    XIsInEffectBefore,66    XIsInEffectAfter)67    SELECT68      1,69      0,70      hia.XOrigin & @QBM_BitPatternXOrigin_Inherit_inv,71      hia.UID_LDPMachine,72      hia.UID_LDAPGroup,73      0,74      175    FROM @DBQueueCurrent x76    JOIN LDPMachineInLDAPGroup hia77      ON hia.UID_LDPMachine = x.uid_parameter78    JOIN LDPMachine h79      ON hia.UID_LDPMachine = h.UID_LDPMachine80    JOIN LDAPGroup g81      ON hia.uid_LDAPGroup = g.uid_LDAPgroup AND g.IsDynamicGroup = 082    WHERE83      h.UID_LDPDomain = g.UID_LDPDomain84    IF dbo.QBM_FGIConfigparmValue('TargetSystem\LDAP\HardwareInGroupFromOrg') > ' '85    BEGIN86      INSERT INTO @SourceData(IsUpcommingContent,87      XOriginBefore,88      Element,89      AssignedElement,90      XOriginAfter,91      XIsInEffectBefore,92      XIsInEffectAfter)93      SELECT94        1,95        0,96        y.uid_LDPMachine,97        y.UID_LDAPGroup,98        @QBM_BitPatternXOrigin_Inherit,99        0,100        1101      FROM(102      SELECT103        nt.UID_LDPMachine,104        ohg.UID_LDAPGroup105      FROM LDPMachine nt106      JOIN @DBQueueCurrent x107        ON nt.UID_LDPMachine = x.uid_parameter AND nt.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay = 0108      JOIN Hardware h109        ON nt.uid_Hardware = h.uid_Hardware110      JOIN WorkDesk w111        ON h.uid_WorkDesk = w.uid_WorkDesk AND w.IsNoInherite = 0112      JOIN(113      SELECT114        hpo.uid_WorkDesk, hpo.uid_org115      FROM helperWorkDeskorg hpo116      UNION117      SELECT118        pio.uid_WorkDesk, pio.uid_org119      FROM WorkDeskinBaseTree pio120      WHERE121        pio.XOrigin > 0) AS hwo122        ON h.uid_WorkDesk = hwo.uid_WorkDesk123      JOIN BaseTreeHasLDAPGroup ohg124        ON ohg.uid_org = hwo.uid_org AND ohg.XOrigin > 0 AND ohg.XIsInEffect = 1125      JOIN BaseTree b126        ON b.uid_org = ohg.uid_org AND b.IsNoInheriteToWorkDesk = 0127      JOIN LDAPGroup gg128        ON ohg.UID_LDAPGroup = gg.UID_LDAPGroup AND gg.IsDynamicGroup = 0 AND nt.UID_LDPDomain = gg.UID_LDPDomain129      UNION all130      SELECT131        m.UID_LDPMachine,132        ohg.UID_LDAPGroup133      FROM(134      SELECT135        m.UID_LDPMachine, hpo.uid_org136      FROM @DBQueueCurrent p137      JOIN LDPMachine m138        ON p.uid_parameter = m.UID_LDPMachine139      JOIN helperHardwareorg hpo140        ON m.uid_Hardware = hpo.uid_Hardware141      UNION142      SELECT143        m.UID_LDPMachine, pio.uid_org144      FROM @DBQueueCurrent p145      JOIN LDPMachine m146        ON p.uid_parameter = m.UID_LDPMachine147      JOIN HardwareinBaseTree pio148        ON m.uid_Hardware = pio.uid_Hardware AND pio.XOrigin > 0) AS hho149      JOIN LDPMachine m150        ON m.UID_LDPMachine = hho.UID_LDPMachine AND m.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay = 0151      JOIN BaseTreeHasLDAPGroup ohg152        ON ohg.uid_org = hho.uid_org AND ohg.XOrigin > 0 AND ohg.XIsInEffect = 1153      JOIN BaseTree b154        ON b.uid_org = ohg.uid_org AND b.IsNoInheriteToHardware = 0155      JOIN LDAPGroup gg156        ON ohg.UID_LDAPGroup = gg.UID_LDAPGroup AND gg.IsDynamicGroup = 0157      JOIN LDAPContainer cu158        ON m.UID_LDAPcontainer = cu.UID_LDAPcontainer AND cu.UID_LDPDomain = gg.UID_LDPDomain) AS y159    END160    IF dbo.QBM_FGIModuleExists('RMS') = 1161    BEGIN162      INSERT INTO @SourceData(IsUpcommingContent,163      XOriginBefore,164      Element,165      AssignedElement,166      XOriginAfter,167      XIsInEffectBefore,168      XIsInEffectAfter)169      SELECT170        1,171        0,172        nt.UID_LDPMachine,173        gg.UID_LDAPGroup,174        @QBM_BitPatternXOrigin_Inherit AS XOrigin,175        0,176        1177      FROM LDPMachine nt178      JOIN @DBQueueCurrent x179        ON nt.UID_LDPMachine = x.uid_parameter AND nt.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay = 0180      JOIN Hardware h181        ON nt.uid_Hardware = h.uid_Hardware182      JOIN WorkDeskHasESet whe183        ON h.uid_WorkDesk = whe.uid_WorkDesk AND whe.XOrigin > 0 AND whe.XIsInEffect = 1184      JOIN ESetHasEntitlement ehe185        ON whe.uid_ESet = ehe.UID_ESet AND ehe.XOrigin > 0 AND ehe.XIsInEffect = 1186      JOIN LDAPGroup gg187        ON ehe.Entitlement = gg.XObjectKey AND gg.IsDynamicGroup = 0188      JOIN LDAPContainer cu189        ON nt.UID_LDAPcontainer = cu.UID_LDAPcontainer AND cu.UID_LDPDomain = gg.UID_LDPDomain190    END191    IF 1 = dbo.DPR_FGIProjectionRootRunning('LDPDomain')192    BEGIN193      INSERT INTO @ObjectKeysToCheck_Projection(Parameter1,194      Parameter2)195      SELECT196        cu.UID_Parameter,197        ro.ObjectKeyRoot198      FROM @DBQueueCurrent cu199      JOIN @Sourcedata sd200        ON cu.UID_Parameter = sd.Element201      JOIN LDAPGroup g202        ON sd.AssignedElement= g.uid_LDAPGroup203      JOIN LDP_VElementAndRoot ro204        ON g.XObjectKey = ro.ObjectKeyElement205      JOIN LDPMachine a206        ON cu.UID_Parameter = a.UID_LDPMachine AND a.UID_LDPDomain <> g.UID_LDPDomain207      WHERE208        ro.ElementTable = 'LDAPGroup'209      EXEC @RowsToReset = DPR_PSlotResetWhileProj_L @DBQueueCurrent,210        @ObjectKeysToCheck_Projection,211        @MyName,212        @SlotNumber213      IF @RowsToReset > 0214      BEGIN215        DELETE @DBQueueCurrent216        FROM @DBQueueCurrent cu217        LEFT218        OUTER219        JOIN QBMDBQueueCurrent d220          WITH(readpast)221          ON cu.UID_DialogDBQueue = d.UID_DialogDBQueue AND d.SlotNumber = @SlotNumber222        WHERE223          d.UID_DialogDBQueue IS NULL224        DELETE @Sourcedata225        FROM @Sourcedata s226        LEFT227        OUTER228        JOIN @DBQueueCurrent cu229          ON s.Element = cu.UID_Parameter230        WHERE231          cu.UID_DialogDBQueue IS NULL232      END233    END234    IF dbo.QBM_FGIConfigparmValue('QER\Structures\Inherite\GroupExclusion') > ' '235    BEGIN236      IF EXISTS(237        SELECT TOP 1 1238        FROM LDAPGroupExclusion ex239        WITH(nolock)240      JOIN @Sourcedata s241        ON ex.UID_LDAPGroupLower = s.AssignedElement242      WHERE243        s.IsUpcommingContent = 1 AND s.XOriginAfter > 0 AND s.XIsInEffectAfter = 1)244      BEGIN245        DECLARE @ExcludeCandidate QER_YExcludeCandidate246        INSERT INTO @ExcludeCandidate(Element,247        AssignedElement,248        XIsInEffectAfter)249        SELECT250          s.Element,251          s.AssignedElement,252          1253        FROM @Sourcedata s254        JOIN(255        SELECT exe.UID_LDAPGroupLower AS UID_Excluded256        FROM LDAPGroupExclusion exe) AS ex257          ON s.AssignedElement = ex.UID_Excluded258        WHERE259          s.IsUpcommingContent = 1 AND s.XOriginAfter > 0 AND s.XIsInEffectAfter = 1260        UNION all261        SELECT262          s.Element,263          s.AssignedElement,264          1265        FROM @Sourcedata s266        JOIN(267        SELECT exe.UID_LDAPGroupHigher AS UID_Excluding268        FROM LDAPGroupExclusion exe) AS ex269          ON s.AssignedElement = ex.UID_Excluding270        WHERE271          s.IsUpcommingContent = 1 AND s.XOriginAfter > 0 AND s.XIsInEffectAfter = 1272        UPDATE @ExcludeCandidate273        SET XIsInEffectAfter = 0274        FROM @ExcludeCandidate l275        JOIN(276        SELECT277          exe.UID_LDAPGroupLower AS UID_Excluded,278          exe.UID_LDAPGroupHigher AS UID_Excluding279        FROM LDAPGroupExclusion exe) AS ex280          ON l.AssignedElement = ex.UID_Excluded281        JOIN(282        SELECT sh.*283        FROM @ExcludeCandidate sh) AS h284          ON l.Element = h.Element AND h.AssignedElement = ex.UID_Excluding285        IF @@ROWCOUNT > 0286        BEGIN287          UPDATE @Sourcedata288          SET XIsInEffectAfter = 0289          FROM @Sourcedata l290          JOIN @ExcludeCandidate k291            ON l.Element = k.Element AND l.AssignedElement = k.AssignedElement AND k.XIsInEffectAfter = 0292          WHERE293            l.IsUpcommingContent = 1 AND l.XOriginAfter > 0 AND l.XIsInEffectAfter = 1294        END295      END296    END297    EXEC QBM_PDBQueueCalculateDelta @SourceData,298      @DeltaQuantity = 0,299      @DeltaDelete = 0,300      @DeltaInsert = 1,301      @DeltaOrigin = 1,302      @CountDeltaQantity = @CountDeltaQantity OUTPUT,303      @CountDeltaOrigin = @CountDeltaOrigin OUTPUT,304      @UseIsInEffect = 1,305      @SlotNumber = @SlotNumber,306      @DBQueueCurrentExtern = @DBQueueCurrent307    IF @CountDeltaOrigin > 0308    BEGIN309      EXEC QBM_PMNTableOriginUpdate 'LDPMachineInLDAPGroup',310      'uid_LDPMachine',311      'uid_LDAPGroup'312    END313    IF @CountDeltaQantity > 0314    BEGIN315      EXEC QBM_PMNTableInsert 'LDPMachineInLDAPGroup',316      'uid_LDPMachine',317      'uid_LDAPGroup',318        @TargetIsView = 0,319        @FKTableNameElement = 'LDPMachine',320        @FKColumnNameElement = 'uid_LDPMachine'321    END322  END TRY323  BEGIN CATCH324    EXEC QBM_PSessionErrorAdd DEFAULT325    RAISERROR('',326    18,327    1)328      WITH NOWAIT329  END CATCH330  endLabel:331END
Open raw exported source
SQL ยท Raw55 lines
1       create   procedure LDP_ZLDPMachineInLDAPGroup (@SlotNumber int) AS begin declare @Sourcedata QBM_YDataForDelta , @CountDeltaQantity int ,2 @CountDeltaOrigin int declare @GenProcID varchar(38) declare @DBQueueCurrent QBM_YDBQueueCurrent declare @ObjectKeysToCheck_Projection QBM_YParameterList3 declare @RowsToReset int declare @MyName nvarchar(64) = object_name(@@procid) declare @QBM_BitPatternXMarkedForDel_Delay int = dbo.QBM_FGIBitPatternXMarkedForDel4('|Delay|', 0) declare @QBM_BitPatternXOrigin_Inherit int = dbo.QBM_FGIBitPatternXOrigin('|Inherit|', 0) declare @QBM_BitPatternXOrigin_Inherit_inv int5 = dbo.QBM_FGIBitPatternXOrigin('|Inherit|', 1)  BEGIN TRY insert into @DBQueueCurrent(UID_DialogDBQueue, UID_Parameter, UID_SubParameter, GenProcID) select6 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 , XIsInEffectBefore, 8XIsInEffectAfter ) select 0, 0 , aig.UID_LDPMachine, aig.UID_LDAPGroup, aig.XOrigin , aig.XIsInEffect, 0 from @DBQueueCurrent x join LDPMachineInLDAPGroup9 aig on aig.UID_LDPMachine = x.uid_parameter join LDAPGroup g on aig.uid_LDAPGroup = g.uid_LDAPgroup and g.IsDynamicGroup = 0  where aig.XMarkedForDeletion10 & @QBM_BitPatternXMarkedForDel_Delay = 0  insert into @SourceData( IsUpcommingContent, XOriginBefore, XOriginAfter , Element, AssignedElement , XIsInEffectBefore11, XIsInEffectAfter ) select 1, 0, hia.XOrigin & @QBM_BitPatternXOrigin_Inherit_inv , hia.UID_LDPMachine, hia.UID_LDAPGroup , 0, 1 from @DBQueueCurrent 12x join LDPMachineInLDAPGroup hia on hia.UID_LDPMachine = x.uid_parameter join LDPMachine h on hia.UID_LDPMachine = h.UID_LDPMachine join LDAPGroup g on13 hia.uid_LDAPGroup = g.uid_LDAPgroup and g.IsDynamicGroup = 0  where h.UID_LDPDomain = g.UID_LDPDomain if dbo.QBM_FGIConfigparmValue('TargetSystem\LDAP\HardwareInGroupFromOrg'14) > ' '  begin insert into @SourceData( IsUpcommingContent, XOriginBefore , Element, AssignedElement, XOriginAfter , XIsInEffectBefore, XIsInEffectAfter15 ) select 1, 0 , y.uid_LDPMachine, y.UID_LDAPGroup, @QBM_BitPatternXOrigin_Inherit , 0, 1 from ( select nt.UID_LDPMachine , ohg.UID_LDAPGroup from LDPMachine16 nt join @DBQueueCurrent x on nt.UID_LDPMachine = x.uid_parameter  and nt.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay = 0 join Hardware h on17 nt.uid_Hardware = h.uid_Hardware join WorkDesk w on h.uid_WorkDesk = w.uid_WorkDesk and w.IsNoInherite = 0 join  ( select hpo.uid_WorkDesk , hpo.uid_org18 from helperWorkDeskorg hpo union select pio.uid_WorkDesk , pio.uid_org from WorkDeskinBaseTree pio where pio.XOrigin > 0   ) as hwo  on h.uid_WorkDesk19 = hwo.uid_WorkDesk join BaseTreeHasLDAPGroup ohg on ohg.uid_org = hwo.uid_org and ohg.XOrigin > 0 and ohg.XIsInEffect = 1 join BaseTree b on b.uid_org20 = ohg.uid_org and b.IsNoInheriteToWorkDesk = 0 join LDAPGroup gg on ohg.UID_LDAPGroup = gg.UID_LDAPGroup and gg.IsDynamicGroup = 0  and nt.UID_LDPDomain21 = gg.UID_LDPDomain union all  select m.UID_LDPMachine , ohg.UID_LDAPGroup from  ( select m.UID_LDPMachine , hpo.uid_org from @DBQueueCurrent p join LDPMachine22 m on p.uid_parameter = m.UID_LDPMachine join helperHardwareorg hpo on m.uid_Hardware = hpo.uid_Hardware union select m.UID_LDPMachine , pio.uid_org from23 @DBQueueCurrent p join LDPMachine m on p.uid_parameter = m.UID_LDPMachine join HardwareinBaseTree pio on m.uid_Hardware = pio.uid_Hardware and pio.XOrigin24 > 0   ) as hho  join LDPMachine m on m.UID_LDPMachine = hho.UID_LDPMachine  and m.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay = 0  join BaseTreeHasLDAPGroup25 ohg on ohg.uid_org = hho.uid_org and ohg.XOrigin > 0 and ohg.XIsInEffect = 1 join BaseTree b on b.uid_org = ohg.uid_org and b.IsNoInheriteToHardware =26 0 join LDAPGroup gg on ohg.UID_LDAPGroup = gg.UID_LDAPGroup and gg.IsDynamicGroup = 0  join LDAPContainer cu on m.UID_LDAPcontainer = cu.UID_LDAPcontainer27  and cu.UID_LDPDomain = gg.UID_LDPDomain ) as y  end  if dbo.QBM_FGIModuleExists('RMS') = 1 begin insert into @SourceData( IsUpcommingContent, XOriginBefore28 , Element, AssignedElement, XOriginAfter , XIsInEffectBefore, XIsInEffectAfter ) select 1, 0 , nt.UID_LDPMachine , gg.UID_LDAPGroup , @QBM_BitPatternXOrigin_Inherit29 as XOrigin , 0, 1 from LDPMachine nt join @DBQueueCurrent x on nt.UID_LDPMachine = x.uid_parameter  and nt.XMarkedForDeletion & @QBM_BitPatternXMarkedForDel_Delay30 = 0 join Hardware h on nt.uid_Hardware = h.uid_Hardware join WorkDeskHasESet whe on h.uid_WorkDesk = whe.uid_WorkDesk and whe.XOrigin > 0 and whe.XIsInEffect31 = 1 join ESetHasEntitlement ehe on whe.uid_ESet = ehe.UID_ESet and ehe.XOrigin > 0 and ehe.XIsInEffect = 1 join LDAPGroup gg on ehe.Entitlement = gg.XObjectKey32 and gg.IsDynamicGroup = 0  join LDAPContainer cu on nt.UID_LDAPcontainer = cu.UID_LDAPcontainer  and cu.UID_LDPDomain = gg.UID_LDPDomain end    if 1 =33 dbo.DPR_FGIProjectionRootRunning ('LDPDomain') begin insert into @ObjectKeysToCheck_Projection(Parameter1, Parameter2) select cu.UID_Parameter, ro.ObjectKeyRoot34 from @DBQueueCurrent cu join @Sourcedata sd on cu.UID_Parameter = sd.Element join LDAPGroup g on sd.AssignedElement= g.uid_LDAPGroup join LDP_VElementAndRoot35 ro on g.XObjectKey = ro.ObjectKeyElement  join LDPMachine a on cu.UID_Parameter = a.UID_LDPMachine and a.UID_LDPDomain <> g.UID_LDPDomain  where ro.ElementTable36 = 'LDAPGroup' exec @RowsToReset = DPR_PSlotResetWhileProj_L @DBQueueCurrent, @ObjectKeysToCheck_Projection, @MyName, @SlotNumber if @RowsToReset > 0 begin37 delete  @DBQueueCurrent from @DBQueueCurrent cu left outer join QBMDBQueueCurrent d with (readpast) on cu.UID_DialogDBQueue = d.UID_DialogDBQueue and 38d.SlotNumber = @SlotNumber where d.UID_DialogDBQueue is null delete  @Sourcedata from @Sourcedata s left outer join @DBQueueCurrent cu on s.Element = cu.UID_Parameter39 where cu.UID_DialogDBQueue is null end end if dbo.QBM_FGIConfigparmValue('QER\Structures\Inherite\GroupExclusion') > ' ' begin if exists (select top 140 1 from LDAPGroupExclusion ex with (nolock) join @Sourcedata s on ex.UID_LDAPGroupLower  = s.AssignedElement where s.IsUpcommingContent = 1 and s.XOriginAfter41 > 0 and s.XIsInEffectAfter = 1 ) begin declare @ExcludeCandidate QER_YExcludeCandidate insert into @ExcludeCandidate(Element, AssignedElement, XIsInEffectAfter42) select s.Element, s.AssignedElement, 1 from @Sourcedata s join ( select exe.UID_LDAPGroupLower as UID_Excluded from LDAPGroupExclusion exe ) as ex on43 s.AssignedElement = ex.UID_Excluded where s.IsUpcommingContent = 1 and s.XOriginAfter > 0 and s.XIsInEffectAfter = 1 union all select s.Element, s.AssignedElement44, 1 from @Sourcedata s join ( select exe.UID_LDAPGroupHigher as UID_Excluding from LDAPGroupExclusion exe ) as ex on s.AssignedElement = ex.UID_Excluding45 where s.IsUpcommingContent = 1 and s.XOriginAfter > 0 and s.XIsInEffectAfter = 1 update @ExcludeCandidate set XIsInEffectAfter = 0 from @ExcludeCandidate46 l  join ( select exe.UID_LDAPGroupLower as UID_Excluded, exe.UID_LDAPGroupHigher as UID_Excluding from LDAPGroupExclusion exe ) as ex on l.AssignedElement47 = ex.UID_Excluded join (select sh.* from @ExcludeCandidate sh  ) as h on l.Element = h.Element and h.AssignedElement = ex.UID_Excluding if @@ROWCOUNT 48> 0 begin update @Sourcedata set XIsInEffectAfter = 0 from @Sourcedata l join @ExcludeCandidate k on l.Element = k.Element and l.AssignedElement = k.AssignedElement49 and k.XIsInEffectAfter = 0 where l.IsUpcommingContent = 1 and l.XOriginAfter > 0 and l.XIsInEffectAfter = 1 end end  end   exec QBM_PDBQueueCalculateDelta50 @SourceData, @DeltaQuantity = 0, @DeltaDelete = 0, @DeltaInsert = 1, @DeltaOrigin = 1, @CountDeltaQantity = @CountDeltaQantity output , @CountDeltaOrigin51 = @CountDeltaOrigin output , @UseIsInEffect = 1 , @SlotNumber = @SlotNumber , @DBQueueCurrentExtern = @DBQueueCurrent if @CountDeltaOrigin > 0 begin exec52 QBM_PMNTableOriginUpdate 'LDPMachineInLDAPGroup', 'uid_LDPMachine', 'uid_LDAPGroup' end if @CountDeltaQantity > 0 begin exec QBM_PMNTableInsert 'LDPMachineInLDAPGroup'53, 'uid_LDPMachine', 'uid_LDAPGroup', @TargetIsView = 0 , @FKTableNameElement = 'LDPMachine' , @FKColumnNameElement = 'uid_LDPMachine' end END TRY BEGIN54 CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH endLabel: end 55