Back to OIM Explorer

dbo.QBM_PIndexCreateGenerated_XI

Stored ProcedureSQL_STORED_PROCEDURESandbox DB

Stored Procedure.

Source: sandbox-db sys.sql_modules

Source size: 1.618 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_FGICodeName source text reference
  • references source dbo.QBM_PIndexCreate source text reference
  • references source dbo.QBM_PIndexCreateGenerated source text reference
  • references source dbo.QBM_PSessionErrorAdd source text reference

Complete Source

SQL67 lines
1CREATE PROCEDURE QBM_PIndexCreateGenerated_XI(2  @TableName varchar(30)3)4AS5BEGIN6  DECLARE @ColumnName varchar(30)7  DECLARE @Indexname varchar(30)8  DECLARE @DebugSwitch int = 09  DECLARE @ElementBufferMulti QBM_YCursorBuffer10  DECLARE @ElementCount int11  DECLARE @ElementIndex int12  SET XACT_ABORT OFF13  BEGIN TRY14    INSERT INTO @ElementBufferMulti(Ident2)15    SELECT c.ColumnName16    FROM DialogTable tc17      WITH(readpast)18    JOIN DialogColumn c19      WITH(readpast)20      ON c.UID_DialogTable = tc.UID_DialogTable AND tc.TableType IN('B',21    'T') AND c.SchemaDataLen = 138 AND c.ColumnName <> 'XObjectKey'22    JOIN sys.tables ts23      WITH(readpast)24      ON tc.TableName = ts.name collate database_default AND ts.type = 'U'25    JOIN sys.schemas s26      WITH(readpast)27      ON ts.schema_id = s.schema_id AND s.name = 'dbo'28    JOIN sys.columns cs29      WITH(readpast)30      ON ts.object_id = cs.object_id AND cs.name = c.ColumnName collate database_default AND NOT EXISTS(31    SELECT TOP 1 132    FROM QBM_VHeavyLoadTables h33    WHERE34      h.TableName = tc.TableName AND h.IsNoAutoIndex = 1) AND tc.TableName = @TableName AND tc.IsMAllTable = 035    ORDER BY 136    SELECT @ElementCount = @@ROWCOUNT37    SELECT @ElementIndex = 138    WHILE @ElementIndex <= @ElementCount39    BEGIN40      SELECT TOP 1 @ColumnName = bu.Ident241      FROM @ElementBufferMulti bu42      WHERE43        bu.ElementIndex = @ElementIndex44      SELECT45        @Indexname = dbo.QBM_FGICodeName('XI',46        @TableName + @ColumnName)47      IF @DebugSwitch > 048      BEGIN49        print @Indexname50      END51      EXEC QBM_PIndexCreate @TableName,52        @indexname,53      0,54        @columnname55      SELECT @ElementIndex += 156    END57  END TRY58  BEGIN CATCH59    EXEC QBM_PSessionErrorAdd DEFAULT60    RAISERROR('',61    18,62    1)63      WITH NOWAIT64  END CATCH65  ende:66  RETURN67END
Open raw exported source
SQL ยท Raw12 lines
1  create   procedure QBM_PIndexCreateGenerated_XI (@TableName varchar(30) ) as begin declare @ColumnName varchar(30) declare @Indexname varchar(302) declare @DebugSwitch int = 0  declare @ElementBufferMulti QBM_YCursorBuffer declare @ElementCount int declare @ElementIndex int SET XACT_ABORT OFF BEGIN3 TRY  insert into @ElementBufferMulti (Ident2) select c.ColumnName from DialogTable tc with (readpast) join DialogColumn c with (readpast) on c.UID_DialogTable4 = tc.UID_DialogTable and tc.TableType in ('B', 'T') and c.SchemaDataLen = 138 and c.ColumnName <> 'XObjectKey'  join sys.tables ts with (readpast) on 5tc.TableName = ts.name collate database_default and ts.type = 'U'  join sys.schemas s with (readpast) on ts.schema_id = s.schema_id and s.name = 'dbo' 6join sys.columns cs with (readpast) on ts.object_id = cs.object_id and cs.name = c.ColumnName collate database_default  and not exists (Select top 1 1 7from QBM_VHeavyLoadTables h where h.TableName = tc.TableName and h.IsNoAutoIndex = 1 ) and tc.TableName = @TableName  and tc.IsMAllTable = 0 order by 18 select @ElementCount = @@ROWCOUNT select @ElementIndex = 1 while @ElementIndex <= @ElementCount begin select top 1 @ColumnName = bu.Ident2 from @ElementBufferMulti9 bu where bu.ElementIndex = @ElementIndex select @Indexname = dbo.QBM_FGICodeName( 'XI', @TableName + @ColumnName ) if @DebugSwitch > 0 begin print @Indexname10 end exec QBM_PIndexCreate @TableName, @indexname, 0, @columnname select @ElementIndex += 1 end END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR11 ('', 18, 1) WITH NOWAIT END CATCH ende: return end 12