Back to OIM Explorer

dbo.QBM_ZPrePropReport

Stored ProcedureSQL_STORED_PROCEDURESandbox DB

Stored Procedure.

Source: sandbox-db sys.sql_modules

Source size: 2.189 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_FGIPrepropConditionDeactiv source text reference
  • references source dbo.QBM_FGISessionContext source text reference
  • references source dbo.QBM_PDBQueueInsert_WaitForComp source text reference
  • references source dbo.QBM_PSessionContextSet source text reference
  • references source dbo.QBM_PSessionErrorAdd source text reference

Complete Source

SQL97 lines
1CREATE PROCEDURE QBM_ZPrePropReport(2  @SlotNumber int3)4AS5BEGIN6  DECLARE @GenProcID varchar(38)7  DECLARE @CountItems int8  DECLARE @GenProcID_R varchar(38) = dbo.QBM_FGISessionContext('')9  DECLARE @DBQueueCurrent QBM_YDBQueueCurrent10  BEGIN TRY11    INSERT INTO @DBQueueCurrent(UID_DialogDBQueue,12    UID_Parameter,13    UID_SubParameter,14    GenProcID)15    SELECT16      UID_DialogDBQueue,17      UID_Parameter,18      UID_SubParameter,19      GenProcID20    FROM QBMDBQueueCurrent cu21      WITH(readpast)22    WHERE23      cu.SlotNumber = @SlotNumber24    IF @@rowcount = 025    BEGIN26      GOTO EndLabel27    END28    SELECT @GenProcID = max(GenProcID)29    FROM @DBQueueCurrent30    WHERE31      GenProcID > ' '32    IF isnull(@Genprocid,33    '') = ''34    BEGIN35      SELECT @GenProcID = newid()36    END37    DECLARE @PrePropHelper QBM_YPrepropHelper38    INSERT INTO @PrePropHelper(uid_parameter,39    isDeactivatedPrior,40    IsDeactivated,41    GenProcID,42    PreProcessorCondition,43    IsDeactivatedOld)44    SELECT45      x.uid_parameter,46      sign(convert(int, isnull(t.isDeactivatedByPreProcessor, 0))47      /*+ convert(int, isnull(rp.isDeactivatedByPreProcessor,0)) */48      ),49      sign(convert(int, isnull(t.isDeactivatedByPreProcessor, 0))50      /*+ convert(int, isnull(rp.isDeactivatedByPreProcessor,0)) */51      ),52      x.GenProcID,53      isnull(o.PreProcessorCondition,54      N ''),55      o.isDeactivatedByPreProcessor56    FROM @DBQueueCurrent x57    JOIN DialogReport o58      ON x.uid_parameter = o.uid_dialogReport59    LEFT60    OUTER61    JOIN dialogtable t62      ON o.UID_DialogTableBase = t.UID_DialogTable63    UPDATE @PrePropHelper64    SET IsDeactivated = dbo.QBM_FGIPrepropConditionDeactiv(h.PreProcessorCondition)65    FROM @PrePropHelper h66    WHERE67      h.PreProcessorCondition > ' ' AND h.IsDeactivated = 068    EXEC QBM_PSessionContextSet 'GenProcID',69      @GenProcID70    UPDATE DialogReport71    SET IsDeactivatedByPreProcessor = x.isDeactivated,72    xdateupdated = GetUTCDate(),73    xuserupdated = 'DBScheduler'74    FROM DialogReport r75    JOIN @PrePropHelper x76      ON r.UID_DialogReport = x.uid_parameter77    WHERE78      r.IsDeactivatedByPreProcessor <> x.IsDeactivated79    SELECT @CountItems = @@rowcount80    IF @CountItems > 081    BEGIN82      EXEC QBM_PDBQueueInsert_WaitForComp 'Report',83        @GenProcID84    END85  END TRY86  BEGIN CATCH87    EXEC QBM_PSessionErrorAdd DEFAULT88    RAISERROR('',89    18,90    1)91      WITH NOWAIT92  END CATCH93  endLabel:94  EXEC QBM_PSessionContextSet 'GenProcID',95    @GenProcID_R96  RETURN97END
Open raw exported source
SQL ยท Raw15 lines
1   create   procedure QBM_ZPrePropReport (@SlotNumber int) as begin  declare @GenProcID varchar(38) declare @CountItems int  declare @GenProcID_R2 varchar(38) = dbo.QBM_FGISessionContext('') declare @DBQueueCurrent QBM_YDBQueueCurrent BEGIN TRY insert into @DBQueueCurrent(UID_DialogDBQueue, UID_Parameter3, UID_SubParameter, GenProcID) select UID_DialogDBQueue, UID_Parameter, UID_SubParameter, GenProcID from QBMDBQueueCurrent cu with (readpast) where cu.SlotNumber4 = @SlotNumber if @@rowcount = 0 begin goto EndLabel end select @GenProcID = max(GenProcID) from @DBQueueCurrent where GenProcID > ' ' if isnull(@Genprocid5, '') = '' begin select @GenProcID = newid() end declare @PrePropHelper QBM_YPrepropHelper insert into @PrePropHelper (uid_parameter , isDeactivatedPrior6 , IsDeactivated , GenProcID , PreProcessorCondition, IsDeactivatedOld) select x.uid_parameter , sign(convert(int, isnull(t.isDeactivatedByPreProcessor7,0)) /*+ convert(int, isnull(rp.isDeactivatedByPreProcessor,0)) */ ) , sign(convert(int, isnull(t.isDeactivatedByPreProcessor,0)) /*+ convert(int, isnull(rp.isDeactivatedByPreProcessor,0)) */8 ) , x.GenProcID, isnull(o.PreProcessorCondition,N''), o.isDeactivatedByPreProcessor from @DBQueueCurrent x join DialogReport o on x.uid_parameter = o.uid_dialogReport9 left outer join dialogtable t on o.UID_DialogTableBase = t.UID_DialogTable   update @PrePropHelper set IsDeactivated = dbo.QBM_FGIPrepropConditionDeactiv10(h.PreProcessorCondition) from @PrePropHelper h where h.PreProcessorCondition > ' ' and h.IsDeactivated = 0  exec QBM_PSessionContextSet 'GenProcID', @GenProcID11 update DialogReport set IsDeactivatedByPreProcessor = x.isDeactivated, xdateupdated = GetUTCDate(), xuserupdated = 'DBScheduler'  from DialogReport r 12join @PrePropHelper x on r.UID_DialogReport = x.uid_parameter where r.IsDeactivatedByPreProcessor <> x.IsDeactivated select @CountItems = @@rowcount if13 @CountItems > 0 begin   exec QBM_PDBQueueInsert_WaitForComp 'Report', @GenProcID   end  END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR14 ('', 18, 1) WITH NOWAIT END CATCH  endLabel: exec QBM_PSessionContextSet 'GenProcID', @GenProcID_R return end 15