Back to OIM Explorer

dbo.QBM_PDBQueueInsert_Int

Stored ProcedureSQL_STORED_PROCEDURESandbox DB

Stored Procedure. Bulk DBQueue insert -> if @UID_Task in ( at line 7; Single DBQueue insert -> at line 52; Single DBQueue insert -> at line 52; Single DBQueue insert -> at line 53

Source: sandbox-db sys.sql_modules

Source size: 8.795 characters

Interpretation

  • Database routine. Review parameters, called procedures, DBQueue inserts, and QBM_PJobCreate helper calls before assuming side effects.
  • DBQueue relation detected. Follow the task procedure and referenced-by list for async processing.

Verified Internal DBQueue Insert Notes

  • Source catalog entry dbo.QBM_PDBQueueInsert_Int is a non-generated SQL stored procedure from sandbox-db sys.sql_modules.
  • The procedure accepts @UID_Task and readonly @DBQueueElements QBM_YDBQueueRaw.
  • The source reads task metadata from QBMDBQueueTaskMetric and falls back to QBMDBQueueTask when needed.
  • For tasks QBM-K-CommonWaitForCompiler and QBM-K-BaseMigrationReady, the source updates DialogDatabase.UID_CutOffTask on the main database.
  • The source inserts into DialogDBQueue in verified branches and sets session context INSERTEDINTODBQUEUE to 1 after successful inserts.
  • The source can enqueue automated follower or predecessor tasks by calling QBM_PDBQueueInsert_Single with @UID_TaskAutomatedFollower or @UID_TaskAutomatedPredecessor.
  • Generated source-index flags show HasDBQueueInsertSingle=1, HasDBQueueInsertBulk=1, HasChangeLimit=0, and HasQbmPJobCreate=0.

Operational meaning: This is the standard internal DBQueue insertion implementation behind the bulk router. It resolves task metadata, writes `DialogDBQueue` rows, maintains inserted-state session context, and can trigger automated predecessor/follower task insertion.

Relations

  • Bulk DBQueue insert -> if @UID_Task in ( at line 7
  • Single DBQueue insert -> at line 52
  • Single DBQueue insert -> at line 52
  • Single DBQueue insert -> at line 53
  • References QBM_PDBQueueInsert_Single
  • References QBM_PDBQueueInsert_Bulk

Typed Edges

  • queues DBQueue task if @UID_Task in ( at line 7 Bulk DBQueue insert -> if @UID_Task in ( at line 7
  • queues DBQueue task at line 52 Single DBQueue insert -> at line 52
  • queues DBQueue task at line 53 Single DBQueue insert -> at line 53
  • references source dbo.QBM_FGIConfigparmValue source text reference
  • references source dbo.QBM_FGISessionContext source text reference
  • references source dbo.QBM_PDBQueueInsert_Bulk source text reference
  • references source dbo.QBM_PDBQueueInsert_Single source text reference
  • references source dbo.QBM_PJournal source text reference
  • references source dbo.QBM_PSessionContextSet source text reference
  • references source dbo.QBM_PSessionErrorAdd source text reference
  • queues DBQueue task if @UID_Task in ( -> unresolved procedure QBM_PDBQueueInsert_Bulk' if @UID_Task in ('QBM-K-CommonWaitForCompiler' , 'QBM-K-BaseMigrationReady') begin update DialogDatabase set UID_CutOffTask = @UID_Task where IsMainDatabase = 1 end exec QBM_PSessionContextSet 'GenProcID', @GenProc…

Complete Source

SQL466 lines
1CREATE PROCEDURE QBM_PDBQueueInsert_Int(2  @UID_Task varchar(38),3  @DBQueueElements QBM_YDBQueueRaw READONLY4)5AS6BEGIN7  DECLARE @msg nvarchar(255)8  DECLARE @PathLength_intern int9  DECLARE @UID_TaskAutomatedFollower varchar(38)10  DECLARE @UID_TaskAutomatedPredecessor varchar(38)11  DECLARE @IsNoGenProcIDCheck BIT12  DECLARE @CountParameter int13  DECLARE @GenProcID_R varchar(38) = dbo.QBM_FGISessionContext('')14  DECLARE @XUser_R nvarchar(64) = dbo.QBM_FGISessionContext('XUser')15  DECLARE @myName nvarchar(64)16  DECLARE @UID_Task_Intern varchar(38)17  DECLARE @DebugStarttime datetime = getutcdate()18  DECLARE @DebugLevel char(1) = 'W'19  DECLARE @DebugMessage nvarchar(4000)20  DECLARE @DebugSwitch int = 021  DECLARE @GenProcIDForAutomated varchar(38)22  DECLARE @RowsFilledIn int = 023  DECLARE @Compressed QBM_YDBQueueRaw24  DECLARE @ErrorBuffer QBM_YSessionError25  SET XACT_ABORT OFF26  BEGIN TRY27    IF NOT EXISTS(28      SELECT TOP 1 129      FROM @DBQueueElements)30    BEGIN31      GOTO endlabel32    END33    SELECT TOP 1 @GenProcIDForAutomated = e.GenProcID34    FROM @DBQueueElements e35    SELECT @myName = 'QBM_PDBQueueInsert_Bulk'36    IF @UID_Task IN('QBM-K-CommonWaitForCompiler',37    'QBM-K-BaseMigrationReady')38    BEGIN39      UPDATE DialogDatabase40      SET UID_CutOffTask = @UID_Task41      WHERE42        IsMainDatabase = 143    END44    EXEC QBM_PSessionContextSet 'GenProcID',45      @GenProcID_R46    EXEC QBM_PSessionContextSet 'XUser',47      @myName48    SELECT49      @Debugmessage = CONCAT('inserted task ',50      @UID_Task)51    IF @DebugSwitch > 052    BEGIN53      EXEC QBM_PJournal @Debugmessage,54        @@procid,55      'D',56        @DebugLevel57    END58    SELECT59      TOP 1 @UID_Task_Intern = t.uid_task,60      @CountParameter = t.CountParameter,61      @UID_TaskAutomatedFollower = t.UID_TaskAutomatedFollower,62      @UID_TaskAutomatedPredecessor = t.UID_TaskAutomatedPredecessor,63      @IsNoGenProcIDCheck = t.IsNoGenProcIDCheck,64      @PathLength_intern = t.PathLength65    FROM QBMDBQueueTaskMetric t66      WITH(readpast)67    WHERE68      UID_Task = @UID_Task69    IF isnull(@UID_Task_Intern,70    '') = ''71    BEGIN72      SELECT73        TOP 1 @UID_Task_Intern = t.uid_task,74        @CountParameter = t.CountParameter,75        @UID_TaskAutomatedFollower = t.UID_TaskAutomatedFollower,76        @UID_TaskAutomatedPredecessor = t.UID_TaskAutomatedPredecessor,77        @IsNoGenProcIDCheck = t.IsNoGenProcIDCheck,78        @PathLength_intern = 1179      FROM QBMDBQueueTask t80        WITH(readpast)81      WHERE82        UID_Task = @UID_Task83      IF isnull(@UID_Task_Intern,84      '') = ''85      BEGIN86        DELETE @ErrorBuffer87        INSERT INTO @ErrorBuffer(ErrorMessage,88        ErrorSeverity,89        ErrorState,90        ErrorNumber,91        ProcedureName,92        ProcedureLine,93        MessageDate,94        GenProcID,95        RepeatCounter,96        IsReThrow,97        SourceCode)98        SELECT99          CONCAT('#LDS#Internal error: no valid Task given ({0}).|',100          isnull(@UID_Task, '<empty>'),101          '|.'),102          18,103          1,104          50000,105          object_name(@@procid),106          ERROR_LINE(),107          GETUTCDATE(),108          NULL,109          0,110          0,111          NULL112        EXEC QBM_PSessionErrorAdd @ErrorBuffer113        SET XACT_ABORT114          ON115        RAISERROR('',116        18,117        1)118          WITH nowait119      END120    END121    IF @DebugSwitch > 0122    BEGIN123      print @myName + ' task ' + @UID_Task + ' nestlevel ' + str(@@nestlevel) print 'CountItems Parameter ' + str(@CountParameter)124    END125    IF @CountParameter > 0126    BEGIN127      IF EXISTS(128        SELECT TOP 1 1129        FROM @DBQueueElements e130        WHERE131          isnull(e.GenProcID, '') = '')132      BEGIN133        SELECT @msg = '#LDS#Internal error: no GenProcID given.|'134        RAISERROR(@msg,135        18,136        1)137          WITH nowait138      END139    END140    IF @IsNoGenProcIDCheck = 0141    BEGIN142      IF '1' <> dbo.QBM_FGIConfigparmValue('Common\ProcessState')143      BEGIN144        SELECT @IsNoGenProcIDCheck = 1145      END146    END147    IF @UID_Task_Intern IN('QBM-K-CommonReCalculate')148    BEGIN149      INSERT INTO DialogDBQueue(UID_DialogDBQueue,150      UID_Task,151      object,152      SubObject,153      PathLength,154      GenProcID)155      SELECT156        newid(),157        @UID_Task_Intern,158        x.Object,159        NULL,160        t.PathLength AS PathLength,161        x.GenProcID162      FROM(163      SELECT164        e.Object AS Object,165        MAX(e.GenProcID) AS GenprocID166      FROM @DBQueueElements e167      WHERE168        e.Object > ' '169      GROUP BY e.Object) AS x170      JOIN QBMDBQueueTaskMetric t171        WITH(readpast)172        ON x.Object = t.uid_task173      WHERE174        NOT EXISTS(175      SELECT TOP 1 1176      FROM DialogDBQueue q177        WITH(readpast)178      WHERE179        q.UID_Task = @UID_Task_Intern AND q.Object = x.Object AND q.Generation >= 0)180      SELECT @RowsFilledIn = @@ROWCOUNT181      IF @RowsFilledIn > 0182      BEGIN183        EXEC QBM_PSessionContextSet 'INSERTEDINTODBQUEUE',184        '1'185      END186      GOTO EndLabel187    END188    IF @UID_Task_Intern IN('QBM-K-XMarkedForDeletionPush',189    'QBM-K-XDateSubItemUpdate',190    'QBM-K-XDateSubItemUpdateFU')191    BEGIN192      IF EXISTS(193        SELECT TOP 1 1194        FROM @DBQueueElements e195        JOIN DialogTable t196        WITH(readpast)197        ON e.Object = t.UID_DialogTable)198      BEGIN199        SET XACT_ABORT200          ON201        RAISERROR('#LDS#Invalid parameter order.|',202        18,203        1)204          WITH NOWAIT205      END206    END207    IF @UID_Task_Intern IN('QBM-K-CommonTaskStart')208    BEGIN209      IF EXISTS(210        SELECT TOP 1 1211        FROM @DBQueueElements e212        JOIN DialogTable t213        WITH(readpast)214        ON e.Object = t.UID_DialogTable)215      BEGIN216        SET XACT_ABORT217          ON218        RAISERROR('#LDS#Invalid Task QBM-K-CommonTaskStart.|',219        18,220        1)221          WITH NOWAIT222      END223    END224    IF @CountParameter = 0225    BEGIN226      IF @IsNoGenProcIDCheck = 0227      BEGIN228        INSERT INTO DialogDBQueue(uid_DialogDBQueue,229        UID_Task,230        object,231        SubObject,232        PathLength,233        GenProcID)234        SELECT235          newid(),236          @UID_Task_Intern,237          NULL,238          NULL,239          @PathLength_intern,240          @GenProcIDForAutomated241        SELECT @RowsFilledIn = @@ROWCOUNT242        IF @RowsFilledIn > 0243        BEGIN244          EXEC QBM_PSessionContextSet 'INSERTEDINTODBQUEUE',245          '1'246        END247      END248      ELSE249      BEGIN250        INSERT INTO DialogDBQueue(uid_DialogDBQueue,251        UID_Task,252        object,253        SubObject,254        PathLength,255        GenProcID)256        SELECT257          newid(),258          @UID_Task_Intern,259          NULL,260          NULL,261          @PathLength_intern,262          @GenProcIDForAutomated263        SELECT @RowsFilledIn = @@ROWCOUNT264        IF @RowsFilledIn > 0265        BEGIN266          EXEC QBM_PSessionContextSet 'INSERTEDINTODBQUEUE',267          '1'268        END269      END270    END271    IF @CountParameter = 1272    BEGIN273      IF @IsNoGenProcIDCheck = 0274      BEGIN275        INSERT INTO @Compressed(Object,276        GenProcID)277        SELECT278          DISTINCT e.Object AS Object,279          e.GenProcID AS GenprocID280        FROM @DBQueueElements e281        WHERE282          e.Object > ' '283      END284      ELSE285      BEGIN286        INSERT INTO @Compressed(Object,287        GenProcID)288        SELECT289          e.Object AS Object,290          MAX(e.GenProcID) AS GenprocID291        FROM @DBQueueElements e292        WHERE293          e.Object > ' '294        GROUP BY e.Object295      END296      IF @IsNoGenProcIDCheck = 0297      BEGIN298        INSERT INTO DialogDBQueue(uid_DialogDBQueue,299        UID_Task,300        object,301        SubObject,302        PathLength,303        GenProcID)304        SELECT305          newid(),306          @UID_Task_Intern,307          x.Object,308          NULL,309          @PathLength_intern,310          x.GenProcID311        FROM @Compressed x312        SELECT @RowsFilledIn = @@ROWCOUNT313        IF @RowsFilledIn > 0314        BEGIN315          EXEC QBM_PSessionContextSet 'INSERTEDINTODBQUEUE',316          '1'317        END318      END319      ELSE320      BEGIN321        INSERT INTO DialogDBQueue(uid_DialogDBQueue,322        UID_Task,323        object,324        SubObject,325        PathLength,326        GenProcID)327        SELECT328          newid(),329          @UID_Task_Intern,330          x.Object,331          NULL,332          @PathLength_intern,333          x.GenProcID334        FROM @Compressed x335        SELECT @RowsFilledIn = @@ROWCOUNT336        IF @RowsFilledIn > 0337        BEGIN338          EXEC QBM_PSessionContextSet 'INSERTEDINTODBQUEUE',339          '1'340        END341      END342    END343    IF @CountParameter = 2344    BEGIN345      IF @IsNoGenProcIDCheck = 0346      BEGIN347        INSERT INTO @Compressed(Object,348        SubObject,349        GenProcID)350        SELECT351          DISTINCT e.Object AS Object,352          e.SubObject AS SubObject,353          e.GenProcID AS GenprocID354        FROM @DBQueueElements e355        WHERE356          e.Object > ' ' AND e.SubObject > ' '357      END358      ELSE359      BEGIN360        INSERT INTO @Compressed(Object,361        SubObject,362        GenProcID)363        SELECT364          e.Object AS Object,365          e.SubObject AS SubObject,366          MAX(e.GenProcID) AS GenprocID367        FROM @DBQueueElements e368        WHERE369          e.Object > ' ' AND e.SubObject > ' '370        GROUP BY e.Object,371        e.SubObject372      END373      IF @IsNoGenProcIDCheck = 0374      BEGIN375        INSERT INTO DialogDBQueue(uid_DialogDBQueue,376        UID_Task,377        object,378        SubObject,379        PathLength,380        GenProcID)381        SELECT382          newid(),383          @UID_Task_Intern,384          x.Object,385          x.SubObject,386          @PathLength_intern,387          x.GenProcID388        FROM @Compressed x389        SELECT @RowsFilledIn = @@ROWCOUNT390        IF @RowsFilledIn > 0391        BEGIN392          EXEC QBM_PSessionContextSet 'INSERTEDINTODBQUEUE',393          '1'394        END395      END396      ELSE397      BEGIN398        INSERT INTO DialogDBQueue(uid_DialogDBQueue,399        UID_Task,400        object,401        SubObject,402        PathLength,403        GenProcID)404        SELECT405          newid(),406          @UID_Task_Intern,407          x.Object,408          x.SubObject,409          @PathLength_intern,410          x.GenProcID411        FROM @Compressed x412        SELECT @RowsFilledIn = @@ROWCOUNT413        IF @RowsFilledIn > 0414        BEGIN415          EXEC QBM_PSessionContextSet 'INSERTEDINTODBQUEUE',416          '1'417        END418      END419    END420    IF @RowsFilledIn > 0 AND(@UID_TaskAutomatedFollower > ' ' OR @UID_TaskAutomatedPredecessor > ' ')421    BEGIN422      IF @UID_TaskAutomatedFollower > ' '423      BEGIN424        EXEC QBM_PDBQueueInsert_Single @UID_TaskAutomatedFollower,425        '',426        '',427          @GenProcIDForAutomated428      END429      IF @UID_TaskAutomatedPredecessor > ' '430      BEGIN431        EXEC QBM_PDBQueueInsert_Single @UID_TaskAutomatedPredecessor,432        '',433        '',434          @GenProcIDForAutomated435      END436    END437    IF @DebugSwitch > 0438    BEGIN439      print 'vor dem Catchblock'440    END441  END TRY442  BEGIN CATCH443    EXEC QBM_PSessionErrorAdd DEFAULT444    RAISERROR('',445    18,446    1)447      WITH NOWAIT448  END CATCH449  endLabel:450  EXEC QBM_PSessionContextSet 'GenProcID',451    @GenProcID_R452  EXEC QBM_PSessionContextSet 'XUser',453    @XUser_R454  IF @DebugSwitch > 0455  BEGIN456    EXEC QBM_PJournal @Debugstarttime,457      @@procid,458    'T',459      @Debuglevel460  END461  IF @DebugSwitch > 0462  BEGIN463    print 'vor dem Return Bulkinsert'464  END465  RETURN466END
Open raw exported source
SQL · Raw57 lines
1      create   procedure QBM_PDBQueueInsert_Int (@UID_Task varchar(38) , @DBQueueElements QBM_YDBQueueRaw readonly          ) as begin  declare 2@msg nvarchar(255) declare @PathLength_intern int  declare @UID_TaskAutomatedFollower varchar(38) declare @UID_TaskAutomatedPredecessor varchar(38) declare3 @IsNoGenProcIDCheck bit declare @CountParameter int   declare @GenProcID_R varchar(38) = dbo.QBM_FGISessionContext('') declare @XUser_R nvarchar(64) =4 dbo.QBM_FGISessionContext('XUser') declare @myName nvarchar(64) declare @UID_Task_Intern varchar(38) declare @DebugStarttime datetime = getutcdate() declare5 @DebugLevel char(1) = 'W' declare @DebugMessage nvarchar(4000) declare @DebugSwitch int = 0 declare @GenProcIDForAutomated varchar(38)  declare @RowsFilledIn6 int = 0  declare @Compressed QBM_YDBQueueRaw declare @ErrorBuffer QBM_YSessionError SET XACT_ABORT OFF BEGIN TRY  if not exists (select top 1 1 from @DBQueueElements7 ) begin goto endlabel end select top 1 @GenProcIDForAutomated = e.GenProcID from @DBQueueElements e select @myName = 'QBM_PDBQueueInsert_Bulk'    if @UID_Task8 in ('QBM-K-CommonWaitForCompiler' , 'QBM-K-BaseMigrationReady') begin update DialogDatabase set UID_CutOffTask = @UID_Task where IsMainDatabase = 1 end9 exec QBM_PSessionContextSet 'GenProcID', @GenProcID_R exec QBM_PSessionContextSet 'XUser', @myName select @Debugmessage = concat('inserted task ' , @UID_Task10) if @DebugSwitch > 0 begin exec QBM_PJournal @Debugmessage, @@procid, 'D', @DebugLevel end select top 1 @UID_Task_Intern = t.uid_task , @CountParameter11 = t.CountParameter , @UID_TaskAutomatedFollower = t.UID_TaskAutomatedFollower , @UID_TaskAutomatedPredecessor = t.UID_TaskAutomatedPredecessor , @IsNoGenProcIDCheck12 = t.IsNoGenProcIDCheck , @PathLength_intern = t.PathLength from QBMDBQueueTaskMetric t with (readpast)  where UID_Task = @UID_Task if isnull(@UID_Task_Intern13,'') = '' begin  select top 1 @UID_Task_Intern = t.uid_task , @CountParameter = t.CountParameter , @UID_TaskAutomatedFollower = t.UID_TaskAutomatedFollower14 , @UID_TaskAutomatedPredecessor = t.UID_TaskAutomatedPredecessor , @IsNoGenProcIDCheck = t.IsNoGenProcIDCheck , @PathLength_intern = 11  from QBMDBQueueTask15 t with (readpast) where UID_Task = @UID_Task if isnull(@UID_Task_Intern,'') = '' begin delete @ErrorBuffer insert into @ErrorBuffer (ErrorMessage, ErrorSeverity16, ErrorState, ErrorNumber , ProcedureName, ProcedureLine, MessageDate , GenProcID, RepeatCounter, IsReThrow, SourceCode) select concat( '#LDS#Internal error: no valid Task given ({0}).|'17 , isnull(@UID_Task, '<empty>') , '|.' ),18, 1, 50000 , object_name(@@procid), ERROR_LINE(), GETUTCDATE() , null, 0, 0, null exec QBM_PSessionErrorAdd 18@ErrorBuffer set XACT_ABORT ON  RAISERROR('', 18, 1) with nowait end end if @DebugSwitch > 0 begin print @myName + ' task ' + @UID_Task + ' nestlevel '19 + str(@@nestlevel) print 'CountItems Parameter ' + str(@CountParameter)         end if @CountParameter > 0 begin            if exists (select top 1 1 20from @DBQueueElements e where isnull(e.GenProcID, '') = '' ) begin  select @msg = '#LDS#Internal error: no GenProcID given.|' RAISERROR(@msg, 18, 1) with21 nowait  end end  if @IsNoGenProcIDCheck = 0 begin if '1' <> dbo.QBM_FGIConfigparmValue('Common\ProcessState') begin select @IsNoGenProcIDCheck = 1 end22 end if @UID_Task_Intern in ('QBM-K-CommonReCalculate'  ) begin insert into DialogDBQueue (UID_DialogDBQueue, UID_Task, object, SubObject, PathLength, 23GenProcID) select newid(), @UID_Task_Intern, x.Object , null, t.PathLength as PathLength , x.GenProcID from ( select e.Object as Object, MAX(e.GenProcID24) as GenprocID from @DBQueueElements e where e.Object > ' ' group by e.Object ) as x join QBMDBQueueTaskMetric t with (readpast) on x.Object = t.uid_task25   where Not exists (select top 1 1 from DialogDBQueue q with (readpast) where q.UID_Task = @UID_Task_Intern and q.Object = x.Object    and q.Generation26 >= 0 )  select @RowsFilledIn = @@ROWCOUNT if @RowsFilledIn > 0 begin  exec QBM_PSessionContextSet 'INSERTEDINTODBQUEUE', '1' end goto EndLabel end  if27 @UID_Task_Intern in ('QBM-K-XMarkedForDeletionPush', 'QBM-K-XDateSubItemUpdate', 'QBM-K-XDateSubItemUpdateFU') begin if exists (select top 1 1 from @DBQueueElements28 e join DialogTable t with (readpast) on e.Object = t.UID_DialogTable ) begin set XACT_ABORT ON  RAISERROR ('#LDS#Invalid parameter order.|', 18, 1) WITH29 NOWAIT end end  if @UID_Task_Intern in ('QBM-K-CommonTaskStart') begin if exists (select top 1 1 from @DBQueueElements e join DialogTable t with (readpast30) on e.Object = t.UID_DialogTable ) begin set XACT_ABORT ON  RAISERROR ('#LDS#Invalid Task QBM-K-CommonTaskStart.|', 18, 1) WITH NOWAIT end end if @CountParameter31 = 0 begin if @IsNoGenProcIDCheck = 0 begin                       insert into DialogDBQueue (uid_DialogDBQueue, UID_Task, object, SubObject, PathLength32, GenProcID) select newid(), @UID_Task_Intern, null , null, @PathLength_intern, @GenProcIDForAutomated select @RowsFilledIn = @@ROWCOUNT if @RowsFilledIn33 > 0 begin  exec QBM_PSessionContextSet 'INSERTEDINTODBQUEUE', '1' end  end else  begin                       insert into DialogDBQueue (uid_DialogDBQueue34, UID_Task, object, SubObject, PathLength, GenProcID) select newid(), @UID_Task_Intern, null , null, @PathLength_intern, @GenProcIDForAutomated select 35@RowsFilledIn = @@ROWCOUNT if @RowsFilledIn > 0 begin  exec QBM_PSessionContextSet 'INSERTEDINTODBQUEUE', '1' end  end end  if @CountParameter = 1 begin36 if @IsNoGenProcIDCheck = 0 begin insert into @Compressed (Object, GenProcID) select distinct e.Object as Object, e.GenProcID as GenprocID from @DBQueueElements37 e where e.Object > ' ' end else begin insert into @Compressed (Object, GenProcID) select e.Object as Object, MAX(e.GenProcID) as GenprocID from @DBQueueElements38 e where e.Object > ' ' group by e.Object end if @IsNoGenProcIDCheck = 0 begin                          insert into DialogDBQueue (uid_DialogDBQueue, UID_Task39, object, SubObject, PathLength, GenProcID) select newid(), @UID_Task_Intern, x.Object , null, @PathLength_intern, x.GenProcID from @Compressed x select40 @RowsFilledIn = @@ROWCOUNT if @RowsFilledIn > 0 begin  exec QBM_PSessionContextSet 'INSERTEDINTODBQUEUE', '1' end  end else  begin                    41      insert into DialogDBQueue (uid_DialogDBQueue, UID_Task, object, SubObject, PathLength, GenProcID) select newid(), @UID_Task_Intern, x.Object , null42, @PathLength_intern, x.GenProcID from @Compressed x select @RowsFilledIn = @@ROWCOUNT if @RowsFilledIn > 0 begin  exec QBM_PSessionContextSet 'INSERTEDINTODBQUEUE'43, '1' end  end end  if @CountParameter = 2 begin if @IsNoGenProcIDCheck = 0 begin insert into @Compressed (Object, SubObject, GenProcID) select distinct44 e.Object as Object, e.SubObject as SubObject, e.GenProcID as GenprocID from @DBQueueElements e where e.Object > ' ' and e.SubObject > ' ' end else begin45 insert into @Compressed (Object, SubObject, GenProcID) select e.Object as Object, e.SubObject as SubObject, MAX(e.GenProcID) as GenprocID from @DBQueueElements46 e where e.Object > ' ' and e.SubObject > ' ' group by e.Object, e.SubObject end if @IsNoGenProcIDCheck = 0 begin                            insert into47 DialogDBQueue (uid_DialogDBQueue, UID_Task, object, SubObject, PathLength, GenProcID) select newid(), @UID_Task_Intern, x.Object , x.SubObject, @PathLength_intern48, x.GenProcID from @Compressed x select @RowsFilledIn = @@ROWCOUNT if @RowsFilledIn > 0 begin  exec QBM_PSessionContextSet 'INSERTEDINTODBQUEUE', '1' end49  end else  begin                            insert into DialogDBQueue (uid_DialogDBQueue, UID_Task, object, SubObject, PathLength, GenProcID) select newid50(), @UID_Task_Intern, x.Object , x.SubObject, @PathLength_intern, x.GenProcID from @Compressed x select @RowsFilledIn = @@ROWCOUNT if @RowsFilledIn > 051 begin  exec QBM_PSessionContextSet 'INSERTEDINTODBQUEUE', '1' end  end end  if @RowsFilledIn > 0 and ( @UID_TaskAutomatedFollower > ' ' or @UID_TaskAutomatedPredecessor52 > ' ' ) begin if @UID_TaskAutomatedFollower > ' ' begin exec QBM_PDBQueueInsert_Single @UID_TaskAutomatedFollower, '', '', @GenProcIDForAutomated end 53if @UID_TaskAutomatedPredecessor > ' ' begin exec QBM_PDBQueueInsert_Single @UID_TaskAutomatedPredecessor, '', '', @GenProcIDForAutomated end end  if @DebugSwitch54 > 0 begin print 'vor dem Catchblock' end END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH endLabel: exec55 QBM_PSessionContextSet 'GenProcID', @GenProcID_R exec QBM_PSessionContextSet 'XUser', @XUser_R if @DebugSwitch > 0 begin exec QBM_PJournal @Debugstarttime56, @@procid, 'T', @Debuglevel end if @DebugSwitch > 0 begin print 'vor dem Return Bulkinsert' end return end 57