Back to OIM Explorer

dbo.QBM_ZProcessStateUpdate

Stored ProcedureSQL_STORED_PROCEDURESandbox DB

Stored Procedure.

Source: sandbox-db sys.sql_modules

Source size: 1.300 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_PSessionErrorAdd source text reference

References

Referenced By

  • No direct source references extracted.

Complete Source

SQL65 lines
1CREATE PROCEDURE QBM_ZProcessStateUpdate(2  @SlotNumber int3)4AS5BEGIN6  DECLARE @XUser nvarchar(64) = object_name(@@procid)7  DECLARE @Xdate datetime = getutcdate()8  BEGIN TRY9    DECLARE @Hilfstabelle QBM_YMNTable10    INSERT INTO @Hilfstabelle(UID_Element1,11    UID_Element2)12    SELECT13      y.uid_parameter,14      w.ProcessState15    FROM(16    SELECT17      p.uid_parameter,18      sum(DISTINCT x.StateLevel) AS StateLevel19    FROM QBMDBQueueCurrent p20      WITH(readpast)21    JOIN DialogProcessChain c22      ON p.uid_parameter = c.GenProcID23    JOIN(24    VALUES('F', 4),('E', 8),('P', 1),('G', 2)) AS x(ChainState, StateLevel)25      ON c.ProcessState = x.ChainState26    WHERE27      p.SlotNumber = @SlotNumber28    GROUP BY p.uid_parameter) AS y29    JOIN(30    VALUES(1, 'P'),31    (2, 'G'),32    (3, 'P'),33    (4, 'F'),34    (5, 'P'),35    (6, 'P'),36    (7, 'P'),37    (8, 'E'),38    (9, 'P'),39    (10, 'P'),40    (11, 'P'),41    (12, 'F'),42    (13, 'P'),43    (14, 'P'),44    (15, 'P')) AS w(StateLevel,45    ProcessState)46      ON y.StateLevel = w.StateLevel47    UPDATE DialogProcess48    SET ProcessState = w.UID_Element2,49    XDateUpdated = @Xdate,50    XUserUpdated = @XUser51    FROM DialogProcess,52    @Hilfstabelle w53    WHERE54      DialogProcess.GenProcID = w.UID_Element1 AND isnull(DialogProcess.ProcessState,55    '') <> w.UID_Element256  END TRY57  BEGIN CATCH58    EXEC QBM_PSessionErrorAdd DEFAULT59    RAISERROR('',60    18,61    1)62      WITH NOWAIT63  END CATCH64  ende:65END
Open raw exported source
SQL ยท Raw10 lines
1     create   procedure QBM_ZProcessStateUpdate (@SlotNumber int)  AS begin   declare @XUser nvarchar(64) = object_name(@@procid) declare @Xdate2 datetime = getutcdate() BEGIN TRY   declare @Hilfstabelle QBM_YMNTable  insert into @Hilfstabelle (UID_Element1 , UID_Element2 ) select y.uid_parameter3 , w.ProcessState from ( select p.uid_parameter, sum(distinct x.StateLevel) as StateLevel  from QBMDBQueueCurrent p with (readpast) join DialogProcessChain4 c on p.uid_parameter = c.GenProcID   join ( values ( 'F', 4)  , ('E', 8) , ('P', 1) , ('G', 2) ) as x (ChainState, StateLevel ) on c.ProcessState = x.ChainState5 where p.SlotNumber = @SlotNumber group by p.uid_parameter ) as y join ( values (1 , 'P')  ,( 2, 'G') ,( 3, 'P') ,( 4, 'F') ,( 5, 'P') ,( 6, 'P') ,( 7,6 'P') ,( 8, 'E') ,( 9, 'P') ,(10, 'P') ,(11, 'P') ,(12, 'F') ,(13, 'P') ,(14, 'P') ,(15, 'P') ) as w (StateLevel , ProcessState) on y.StateLevel = w.StateLevel7  update DialogProcess set ProcessState = w.UID_Element2   , XDateUpdated = @Xdate , XUserUpdated = @XUser from DialogProcess, @Hilfstabelle w where DialogProcess.GenProcID8 = w.UID_Element1  and isnull(DialogProcess.ProcessState,'') <> w.UID_Element2  END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 189, 1) WITH NOWAIT END CATCH ende: end 10