Back to OIM Explorer

dbo.QBM_PSchemaBindDisable

Stored ProcedureSQL_STORED_PROCEDURESandbox DB

Stored Procedure.

Source: sandbox-db sys.sql_modules

Source size: 1.314 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_FTSchemaDependencies source text reference
  • references source dbo.QBM_FGISessionErrorRethrow source text reference
  • references source dbo.QBM_PSessionErrorAdd source text reference

Complete Source

SQL71 lines
1CREATE PROCEDURE QBM_PSchemaBindDisable(2  @TableName nvarchar(64)3)4AS5BEGIN6  DECLARE @SQLcmd nvarchar(max)7  DECLARE @ObjectName nvarchar(64)8  DECLARE @ObjectType nvarchar(2)9  DECLARE @ScriptCode nvarchar(max)10  DECLARE @Elements QBM_YCursorBuffer11  DECLARE @ElementCount int12  DECLARE @ElementIndex int13  SET XACT_ABORT OFF14  BEGIN TRY15    SET nocount16      ON17    INSERT INTO @Elements(LongIdent1,18    Ident1,19    ContentFull)20    SELECT21      ObjectName,22      ObjectType,23      SourceCode24    FROM dbo.QBM_FTSchemaDependencies(@TableName,25    1)26    WHERE27      ObjectType IN('F',28    'V')29    SELECT @ElementCount = @@ROWCOUNT30    SELECT @ElementIndex = 131    WHILE @ElementIndex <= @ElementCount32    BEGIN33      SELECT34        TOP 1 @ObjectName = bu.LongIdent1,35        @ObjectType = bu.Ident1,36        @ScriptCode = bu.ContentFull37      FROM @elements bu38      WHERE39        bu.ElementIndex = @ElementIndex40      IF @ObjectType = 'V'41      BEGIN42        SELECT43          @SQLcmd = CONCAT('drop view if exists ',44          @ObjectName)45      END46      ELSE47      BEGIN48        SELECT49          @SQLcmd = CONCAT('drop function if exists dbo.',50          @ObjectName)51      END52      EXEC sp_executesql @SQLcmd53      SELECT54        @SQLcmd = replace(@ScriptCode,55        'with schemabinding',56        ' ')57      EXEC sp_executesql @SQLcmd58      SELECT @ElementIndex += 159    END60  END TRY61  BEGIN CATCH62    EXEC QBM_PSessionErrorAdd DEFAULT63    DECLARE @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow()64    RAISERROR(@Rethrow,65    18,66    1)67      WITH NOWAIT68  END CATCH69  endLabel:70  RETURN71END
Open raw exported source
SQL ยท Raw10 lines
1  create   procedure QBM_PSchemaBindDisable (@TableName nvarchar(64) ) as begin declare @SQLcmd nvarchar(max) declare @ObjectName nvarchar(64) declare2 @ObjectType nvarchar(2) declare @ScriptCode nvarchar(max) declare @Elements QBM_YCursorBuffer declare @ElementCount int declare @ElementIndex int SET 3XACT_ABORT OFF BEGIN TRY set nocount on insert into @Elements (LongIdent1 , Ident1 , ContentFull ) select ObjectName, ObjectType, SourceCode from dbo.QBM_FTSchemaDependencies4 (@TableName, 1) where ObjectType in ('F', 'V') select @ElementCount = @@ROWCOUNT select @ElementIndex = 1 while @ElementIndex <= @ElementCount begin select5 top 1 @ObjectName = bu.LongIdent1 , @ObjectType = bu.Ident1 , @ScriptCode = bu.ContentFull from @elements bu where bu.ElementIndex = @ElementIndex if 6@ObjectType = 'V' begin select @SQLcmd = concat('drop view if exists ', @ObjectName) end else begin select @SQLcmd = concat('drop function if exists dbo.'7, @ObjectName) end exec sp_executesql @SQLcmd select @SQLcmd = replace(@ScriptCode, 'with schemabinding', ' ') exec sp_executesql @SQLcmd select @ElementIndex8 += 1 end  END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default declare @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow() RAISERROR (@Rethrow,9 18, 1) WITH NOWAIT END CATCH endLabel: return end 10