Back to OIM Explorer

dbo.QBM_PBufferC_RestoreOneColumn

Stored ProcedureSQL_STORED_PROCEDURESandbox DB

Stored Procedure.

Source: sandbox-db sys.sql_modules

Source size: 1.356 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_FGIColumnExists source text reference
  • references source dbo.QBM_FGIColumnExistsInSchema source text reference
  • references source dbo.QBM_FGISessionErrorRethrow source text reference
  • references source dbo.QBM_FSQCVBufferToColumn source text reference
  • references source dbo.QBM_PExecuteSQLWithRetry_LLP source text reference
  • references source dbo.QBM_PSessionErrorAdd source text reference
  • references source dbo.QBM_PSessionErrorClean source text reference

Complete Source

SQL67 lines
1CREATE PROCEDURE QBM_PBufferC_RestoreOneColumn(2  @TableName varchar(30),3  @columnname varchar(30),4  @ObjectKey varchar(138)5)6AS7BEGIN8  DECLARE @SQLCmd nvarchar(max)9  DECLARE @DebugSwitch int = 010  SET XACT_ABORT OFF11  BEGIN TRY12    SELECT13      @SQLCmd = CONCAT('1415updat',16      'e ',17      @TableName,18      '19	set ',20      @ColumnName,21      ' = ',22      dbo.QBM_FSQCVBufferToColumn(@TableName, @ColumnName, 'cf', 0),23    CASE24      WHEN dbo.QBM_FGIColumnExistsInSchema(@TableName, 'XDateUpdated') = 1 AND @columnname NOT LIKE 'X[d,u][a,s][t,e][e,r]updated' THEN25    CONCAT('', '	--3410126								, XDateUpdated = getutcdate()27								, XUserUpdated = ''', object_name(@@procid),28    '''29								')30    ELSE ''31    END,32    '33	from ',34    @TableName,35    ' t join QBMBufferConfig cf on cf.TableName = ''',36    @TableName,37    '''38											and cf.ColumnName = ''',39    @ColumnName,40    '''41											and t.XObjectKey = cf.ObjectKeyOfRow42	where t.XObjectKey = ''',43    @ObjectKey,44    '''45	46')47    IF @DebugSwitch > 048    BEGIN49      print @SQLCmd50    END51    EXEC QBM_PExecuteSQLWithRetry_LLP @SQLStatement = @SQLCmd,52      @LockTimeout_ms = DEFAULT,53      @MaxWaitTimeForLock_s = 4.0,54      @ProcIDForJournal = DEFAULT,55      @HandleErrorSilent = 056    EXEC QBM_PSessionErrorClean57  END TRY58  BEGIN CATCH59    EXEC QBM_PSessionErrorAdd DEFAULT60    DECLARE @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow()61    RAISERROR(@Rethrow,62    18,63    1)64      WITH NOWAIT65  END CATCH66  ende:67END
Open raw exported source
SQL ยท Raw22 lines
1   create   procedure QBM_PBufferC_RestoreOneColumn ( @TableName varchar(30) , @columnname varchar(30) , @ObjectKey varchar(138) ) as begin declare2 @SQLCmd nvarchar(max) declare @DebugSwitch int = 0  SET XACT_ABORT OFF BEGIN TRY  select @SQLCmd = concat( '34updat','e ', @TableName , '5	set ', @ColumnName6 ,' = ', dbo.QBM_FSQCVBufferToColumn(@TableName, @ColumnName, 'cf', 0) , case when dbo.QBM_FGIColumnExistsInSchema(@TableName, 'XDateUpdated') = 1 and 7@columnname not like 'X[d,u][a,s][t,e][e,r]updated' then concat('' , '	--341018								, XDateUpdated = getutcdate()9								, XUserUpdated = ''', object_name10(@@procid) , '''11								') else '' end , '12	from ', @TableName , ' t join QBMBufferConfig cf on cf.TableName = ''' , @TableName , '''13											and cf.ColumnName = '''14 , @ColumnName , '''15											and t.XObjectKey = cf.ObjectKeyOfRow16	where t.XObjectKey = ''', @ObjectKey , '''17	18'  ) if @DebugSwitch > 0 begin print19 @SQLCmd end exec QBM_PExecuteSQLWithRetry_LLP @SQLStatement = @SQLCmd , @LockTimeout_ms = default , @MaxWaitTimeForLock_s = 4.0 , @ProcIDForJournal = 20default , @HandleErrorSilent = 0 exec QBM_PSessionErrorClean END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default declare @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow21() RAISERROR (@Rethrow, 18, 1) WITH NOWAIT END CATCH ende: end 22