Back to OIM Explorer

dbo.QBM_PBufferT_FillAll_CCC

Stored ProcedureSQL_STORED_PROCEDURESandbox DB

Stored Procedure.

Source: sandbox-db sys.sql_modules

Source size: 1.873 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_PBufferT_FillTable source text reference
  • references source dbo.QBM_PBufferT_FillTable_CCC source text reference
  • references source dbo.QBM_PSessionErrorAdd source text reference

Complete Source

SQL86 lines
1CREATE PROCEDURE QBM_PBufferT_FillAll_CCC(2  @TempTableName varchar(30)3)4AS5BEGIN6  DECLARE @cmd nvarchar(max)7  DECLARE @TableName varchar(30)8  DECLARE @DebugSwitch int = 09  DECLARE @TableNames QBM_YCursorBuffer10  DECLARE @ElementCount int11  DECLARE @ElementIndex int12  SET XACT_ABORT OFF13  BEGIN TRY14    SELECT15      @cmd = '16if exists (select top 1 117			from ' + @TempTableName + '18		)19 begin 20	delete ' + @TempTableName + '21 end22 '23    EXEC sp_executesql @cmd24    SELECT25      @cmd = CONCAT('2627  select t.TableName28	from DialogTable t 29			join sys.tables tt on t.TableName = tt.name30								and tt.type_desc = ''USER_TABLE''31	where 	1=1'32      ,33      '	34	 and t.usagetype in (''CONFIGURATION'', ''USERDATA'', ''MATERIAL'') 35	 and (t.IsTransportDisabled  = 036			or t.tabletype = ''B'' and exists (select top 1 1 37												from dialogtable v 38												where v.UID_DialogTableBase = t.UID_DialogTable39												and v.IsTransportDisabled = 040												)41		)42	 '43      ,44      '	45	 and exists (select top 1 1 46					from QBM_VSchemaColumns ok 47					where ok.TABLE_NAME = t.TableName48						and ok.Column_name = ''XObjectKey''49				)'50      ,51      ' and t.tablename not in ( ''QBMNonLinearDepend''52								)53	order by t.TableName54		')55    IF @DebugSwitch > 056    BEGIN57      print @cmd58    END59    INSERT INTO @TableNames(Ident1)60    EXEC sp_executesql @cmd61    SELECT @ElementCount = @@ROWCOUNT62    SELECT @ElementIndex = 163    WHILE @ElementIndex <= @ElementCount64    BEGIN65      SELECT TOP 1 @TableName = bu.Ident166      FROM @TableNames bu67      WHERE68        bu.ElementIndex = @ElementIndex69      IF @DebugSwitch > 070      BEGIN71        print 'Dumping Table ' + @TableName72      END73      EXEC QBM_PBufferT_FillTable_CCC @TableName,74        @TempTableName = @TempTableName75      SELECT @ElementIndex += 176    END77  END TRY78  BEGIN CATCH79    EXEC QBM_PSessionErrorAdd DEFAULT80    DECLARE @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow()81    RAISERROR(@Rethrow,82    18,83    1)84      WITH NOWAIT85  END CATCH86END
Open raw exported source
SQL ยท Raw42 lines
1   create   procedure QBM_PBufferT_FillAll_CCC ( @TempTableName varchar(30) )  as begin declare @cmd nvarchar(max) declare @TableName varchar(302) declare @DebugSwitch int = 0 declare @TableNames QBM_YCursorBuffer declare @ElementCount int declare @ElementIndex int SET XACT_ABORT OFF BEGIN TRY select3 @cmd = '4if exists (select top 1 15			from ' + @TempTableName + '6		)7 begin 8	delete ' + @TempTableName + '9 end10 ' exec sp_executesql @cmd select11 @cmd = concat('1213  select t.TableName14	from DialogTable t 15			join sys.tables tt on t.TableName = tt.name16								and tt.type_desc = ''USER_TABLE''17	where 	1=1'18  , '	19	 and t.usagetype in (''CONFIGURATION'', ''USERDATA'', ''MATERIAL'') 20	 and (t.IsTransportDisabled  = 021			or t.tabletype = ''B'' and exists (select top 1 1 22												from dialogtable v 23												where v.UID_DialogTableBase = t.UID_DialogTable24												and v.IsTransportDisabled = 025												)26		)27	 '28 , '	29	 and exists (select top 1 1 30					from QBM_VSchemaColumns ok 31					where ok.TABLE_NAME = t.TableName32						and ok.Column_name = ''XObjectKey''33				)'34 , ' and t.tablename not in ( ''QBMNonLinearDepend''35								)36	order by t.TableName37		' )  if @DebugSwitch > 0 begin print @cmd end insert into @TableNames38(Ident1 ) exec sp_executesql @cmd select @ElementCount = @@ROWCOUNT select @ElementIndex = 1 while @ElementIndex <= @ElementCount begin select top 1 @TableName39 = bu.Ident1  from @TableNames bu where bu.ElementIndex = @ElementIndex  if @DebugSwitch > 0 begin print 'Dumping Table ' + @TableName end exec QBM_PBufferT_FillTable_CCC40 @TableName , @TempTableName = @TempTableName select @ElementIndex += 1 end  END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default declare @Rethrow varchar41(1000) = dbo.QBM_FGISessionErrorRethrow() RAISERROR (@Rethrow, 18, 1) WITH NOWAIT END CATCH end 42