Back to OIM Explorer

dbo.QBM_PBufferT_FillSnapshot

Stored ProcedureSQL_STORED_PROCEDURESandbox DB

Stored Procedure.

Source: sandbox-db sys.sql_modules

Source size: 2.196 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_FGIDBOwner source text reference
  • references source dbo.QBM_FGISessionErrorRethrow source text reference
  • references source dbo.QBM_PBufferT_FillTable source text reference
  • references source dbo.QBM_PJournal source text reference
  • references source dbo.QBM_PSessionErrorAdd source text reference

Complete Source

SQL99 lines
1CREATE PROCEDURE QBM_PBufferT_FillSnapshot(2  @TempTableName nvarchar(64),3  @ModuleName varchar(3) = '#'4)5AS6BEGIN7  DECLARE @cmd nvarchar(max)8  DECLARE @TableName varchar(30)9  DECLARE @DebugLevel char(1) = 'W'10  DECLARE @DebugSwitch int = 011  DECLARE @TableNames QBM_YCursorBuffer12  DECLARE @ElementCount int13  DECLARE @ElementIndex int14  DECLARE @ErrorMessage nvarchar(4000)15  DECLARE @ErrorSeverity int16  DECLARE @ErrorState int17  DECLARE @TargetModule varchar(3)18  SET XACT_ABORT OFF19  BEGIN TRY20    IF @ModuleName = '#'21    BEGIN22      SELECT @ModuleName = dbo.QBM_FGIDBOwner()23    END24    SELECT @TargetModule = @ModuleName25    SELECT26      @cmd = N '2728  select t.TableName29	from DialogTable t 30			join sys.tables tt on t.TableName = tt.name  collate database_default31								and tt.type_desc = ''USER_TABLE''32	where 	1=1'33    SELECT34      @cmd = @cmd + N '	35	 and t.usagetype in (''CONFIGURATION'', ''USERDATA'', ''MATERIAL'') 36	 and (t.IsTransportDisabled  = 037			or t.tabletype = ''B'' and exists (select top 1 1 38												from dialogtable v 39												where v.UID_DialogTableBase = t.UID_DialogTable40												and v.IsTransportDisabled = 041												)42		)43	 '44    SELECT45      @cmd = @cmd + N '	46	 and exists (select top 1 1 from INFORMATION_SCHEMA.COLUMNS ok 47					where ok.TABLE_NAME = t.TableName48						and ok.Column_name = ''XObjectKey''49				)'50    IF @DebugSwitch > 051    BEGIN52      EXEC QBM_PJournal @Cmd,53        @@procid,54      'D',55        @DebugLevel56    END57    BEGIN TRY58      INSERT INTO @TableNames(Ident1)59      EXEC sp_executesql @cmd60    END TRY61    BEGIN CATCH62      EXEC QBM_PSessionErrorAdd DEFAULT,63        @Cmd64      RAISERROR('',65      18,66      1)67        WITH NOWAIT68    END CATCH69    SELECT @ElementCount = count(*)70    FROM @TableNames71    SELECT @ElementIndex = 172    WHILE @ElementIndex <= @ElementCount73    BEGIN74      SELECT @TableName = NULL75      SELECT TOP 1 @TableName = bu.Ident176      FROM @TableNames bu77      WHERE78        bu.ElementIndex = @ElementIndex79      IF @DebugSwitch > 080      BEGIN81        print 'Dumping Table ' + @TableName82      END83      EXEC QBM_PBufferT_FillTable @TempTableName,84        @TargetModule,85        @TableName,86      '1=1',87        @ModuleName88      SELECT @ElementIndex += 189    END90  END TRY91  BEGIN CATCH92    EXEC QBM_PSessionErrorAdd DEFAULT93    DECLARE @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow()94    RAISERROR(@Rethrow,95    18,96    1)97      WITH NOWAIT98  END CATCH99END
Open raw exported source
SQL ยท Raw33 lines
1  create   procedure QBM_PBufferT_FillSnapshot ( @TempTableName nvarchar(64) , @ModuleName varchar(3) = '#' ) as begin declare @cmd nvarchar(max2) declare @TableName varchar(30) declare @DebugLevel char(1) = 'W' declare @DebugSwitch int = 0 declare @TableNames QBM_YCursorBuffer declare @ElementCount3 int declare @ElementIndex int  declare @ErrorMessage nvarchar(4000) declare @ErrorSeverity int declare @ErrorState int declare @TargetModule varchar(34) SET XACT_ABORT OFF BEGIN TRY if @ModuleName = '#' begin select @ModuleName = dbo.QBM_FGIDBOwner() end select @TargetModule = @ModuleName select @cmd 5= N'67  select t.TableName8	from DialogTable t 9			join sys.tables tt on t.TableName = tt.name  collate database_default10								and tt.type_desc = ''USER_TABLE''11	where 	1=1'12 select @cmd = @cmd + N'	13	 and t.usagetype in (''CONFIGURATION'', ''USERDATA'', ''MATERIAL'') 14	 and (t.IsTransportDisabled  = 015			or t.tabletype = ''B'' and exists (select top 1 1 16												from dialogtable v 17												where v.UID_DialogTableBase = t.UID_DialogTable18												and v.IsTransportDisabled = 019												)20		)21	 '22 select @cmd = @cmd + N'	23	 and exists (select top 1 1 from INFORMATION_SCHEMA.COLUMNS ok 24					where ok.TABLE_NAME = t.TableName25						and ok.Column_name = ''XObjectKey''26				)'27   if @DebugSwitch > 0 begin exec QBM_PJournal @Cmd, @@procid, 'D', @DebugLevel end  begin try insert into @TableNames(Ident1 ) exec sp_executesql @cmd28 end try begin catch exec QBM_PSessionErrorAdd default, @Cmd RAISERROR ('', 18, 1) WITH NOWAIT end catch select @ElementCount = count(*) from @TableNames29 select @ElementIndex = 1 while @ElementIndex <= @ElementCount begin select @TableName = null select top 1 @TableName = bu.Ident1  from @TableNames bu 30where bu.ElementIndex = @ElementIndex if @DebugSwitch > 0 begin print 'Dumping Table ' + @TableName end exec QBM_PBufferT_FillTable @TempTableName , @TargetModule31 , @TableName , '1=1' , @ModuleName select @ElementIndex += 1 end  END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default declare @Rethrow varchar(1000)32 = dbo.QBM_FGISessionErrorRethrow() RAISERROR (@Rethrow, 18, 1) WITH NOWAIT END CATCH end 33