Back to OIM Explorer

dbo.QBM_PSingleUserRequest

Stored ProcedureSQL_STORED_PROCEDURESandbox DB

Stored Procedure.

Source: sandbox-db sys.sql_modules

Source size: 1.179 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_FGISessionErrorRethrow source text reference
  • references source dbo.QBM_PSessionErrorAdd source text reference

Complete Source

SQL58 lines
1CREATE PROCEDURE QBM_PSingleUserRequest(2  @RequestingProcessID int = 03)4AS5BEGIN6  DECLARE @Erg int = 07  DECLARE @SingleUserProcess int8  DECLARE @SingleUserStart datetime9  DECLARE @XUser nvarchar(64) = object_name(@@procid)10  DECLARE @Xdate datetime = getutcdate()11  SET XACT_ABORT OFF12  BEGIN TRY13    IF NOT EXISTS(14      SELECT TOP 1 115      FROM sys.tables t16      WHERE17        t.name = 'DialogDatabase')18    BEGIN19      SELECT @erg = 120      GOTO endLabel21    END22    SELECT23      TOP 1 @SingleUserProcess = SingleUserProcess,24      @SingleUserStart = SingleUserStart25    FROM DialogDatabase26    WHERE27      IsMainDatabase = 128    IF @SingleUserProcess IS NULL29    BEGIN30      SELECT @SingleUserProcess = 031    END32    IF @RequestingProcessID = 033    BEGIN34      SELECT @RequestingProcessID = @@SPID35    END36    IF @SingleUserProcess = 0 OR @SingleUserProcess = @RequestingProcessID37    BEGIN38      UPDATE DialogDatabase39      SET SingleUserProcess = @RequestingProcessID,40      SingleUserStart = GETUTCDATE(),41      XDateUpdated = @Xdate,42      XUserUpdated = @XUser43      WHERE44        IsMainDatabase = 145      SELECT @Erg = 146    END47  END TRY48  BEGIN CATCH49    EXEC QBM_PSessionErrorAdd DEFAULT50    DECLARE @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow()51    RAISERROR(@Rethrow,52    18,53    1)54      WITH NOWAIT55  END CATCH56  endLabel:57  RETURN(@erg)58END
Open raw exported source
SQL ยท Raw9 lines
1   create   procedure QBM_PSingleUserRequest (@RequestingProcessID int = 0 ) as begin declare @Erg int = 0 declare @SingleUserProcess int declare2 @SingleUserStart datetime declare @XUser nvarchar(64) = object_name(@@procid) declare @Xdate datetime = getutcdate() SET XACT_ABORT OFF BEGIN TRY if not3 exists (select top 1 1 from sys.tables t where t.name = 'DialogDatabase' ) begin select @erg = 1 goto endLabel end select top 1 @SingleUserProcess = SingleUserProcess4 , @SingleUserStart = SingleUserStart from DialogDatabase where IsMainDatabase = 1 if @SingleUserProcess is null begin select @SingleUserProcess = 0 end5 if @RequestingProcessID = 0 begin select @RequestingProcessID = @@SPID end if @SingleUserProcess = 0 or @SingleUserProcess = @RequestingProcessID begin6  update DialogDatabase set SingleUserProcess = @RequestingProcessID , SingleUserStart = GETUTCDATE() , XDateUpdated = @Xdate , XUserUpdated = @XUser where7 IsMainDatabase = 1 select @Erg = 1 end END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default declare @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow8() RAISERROR (@Rethrow, 18, 1) WITH NOWAIT END CATCH  endLabel: return (@erg) end 9