Back to OIM Explorer

dbo.QBM_PIndicatorChange

Stored ProcedureSQL_STORED_PROCEDURESandbox DB

Stored Procedure.

Source: sandbox-db sys.sql_modules

Source size: 2.069 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_PSessionErrorAdd source text reference
  • references source dbo.QBM_TUIndicator474488 source text reference

Complete Source

SQL94 lines
1CREATE PROCEDURE QBM_PIndicatorChange(2  @Enable BIT3)4AS5BEGIN6  DECLARE @ret int = 07  DECLARE @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow()8  DECLARE @CheckInterval_VI_DB varchar(64) = '00:00:10.5'9  SET XACT_ABORT OFF10  BEGIN TRY11    IF @Enable = 012    BEGIN13      IF EXISTS(14        SELECT TOP 1 115        FROM sys.tables t16        JOIN sys.triggers tr17          ON tr.parent_id = t.object_id18        WHERE19          t.name = 'DialogDatabase' AND tr.name = 'QBM_TUIndicator474488' AND tr.is_disabled = 0) AND EXISTS(20      SELECT TOP 1 121      FROM sys.tables t22      JOIN sys.triggers tr23        ON tr.parent_id = t.object_id24      WHERE25        t.name = 'DialogDatabase' AND tr.name = 'QBM_TUIndicator474488')26      BEGIN27        IF @@TRANCOUNT > 028        BEGIN29          RAISERROR('#LDS#Disabling indicator trigger requires transaction-free state.|',30          18,31          1)32            WITH nowait33          GOTO EndLabel34        END35        ALTER TABLE DialogDatabase disable Trigger QBM_TUIndicator474488 waitfor delay @CheckInterval_VI_DB36      END37    END38    ELSE39    BEGIN40      IF NOT EXISTS(41        SELECT TOP 1 142        FROM sys.foreign_keys fk43        WITH(readpast)44        JOIN sys.objects c45          WITH(readpast)46          ON c.object_id = fk.parent_object_id47        JOIN sys.objects p48          WITH(readpast)49          ON p.object_id = fk.referenced_object_id50        WHERE51          fk.type = 'F' AND c.type IN('U') AND p.type IN('U') AND fk.is_disabled = 152      ) AND NOT EXISTS(53      SELECT TOP 1 154      FROM sys.objects o55        WITH(readpast)56      JOIN sys.triggers t57        WITH(readpast)58        ON o.object_id = t.parent_id59      WHERE60        o.type IN('U') AND t.is_disabled = 1 AND t.name != 'QBM_TUIndicator474488'61    ) AND EXISTS(62    SELECT TOP 1 163    FROM sys.objects o64      WITH(readpast)65    JOIN sys.triggers t66      WITH(readpast)67      ON o.object_id = t.parent_id68    WHERE69      o.type IN('U') AND t.is_disabled = 1 AND t.name != 'QBM_TUIndicator474488' AND o.name = 'DialogDatabase'70  ) AND EXISTS(71  SELECT TOP 1 172  FROM sys.tables t73  JOIN sys.triggers tr74    ON tr.parent_id = t.object_id75  WHERE76    t.name = 'DialogDatabase' AND tr.name = 'QBM_TUIndicator474488'77)78BEGIN79  ALTER TABLE DialogDatabase enable Trigger QBM_TUIndicator47448880END81END82END TRY83BEGIN CATCH84  EXEC QBM_PSessionErrorAdd DEFAULT85  RAISERROR(86    @Rethrow,87    18,88    189  )90    WITH NOWAIT91END CATCH92endLabel:93RETURN @ret94END
Open raw exported source
SQL ยท Raw15 lines
1     create   procedure QBM_PIndicatorChange (@Enable bit) as begin declare @ret int = 0 declare @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow2() declare @CheckInterval_VI_DB varchar(64) = '00:00:10.5'  SET XACT_ABORT OFF BEGIN TRY if @Enable = 0  begin  if exists (select top 1 1 from sys.tables3 t join sys.triggers tr on tr.parent_id = t.object_id where t.name = 'DialogDatabase' and tr.name = 'QBM_TUIndicator474488' and tr.is_disabled = 0 )  and4 exists (select top 1 1 from sys.tables t join sys.triggers tr on tr.parent_id = t.object_id where t.name = 'DialogDatabase' and tr.name = 'QBM_TUIndicator474488'5 ) begin  if @@TRANCOUNT > 0 begin raiserror ('#LDS#Disabling indicator trigger requires transaction-free state.|', 18, 1) with nowait goto EndLabel end6 alter table DialogDatabase disable Trigger QBM_TUIndicator474488  waitfor delay @CheckInterval_VI_DB  end   end else  begin  if not exists (select top7 1 1 from sys.foreign_keys fk with (readpast) join sys.objects c with (readpast) on c.object_id = fk.parent_object_id join sys.objects p with (readpast8) on p.object_id = fk.referenced_object_id where fk.type = 'F' and c.type in( 'U' ) and p.type in( 'U' ) and fk.is_disabled = 1 ) and not exists (select9 top 1 1 from sys.objects o with (readpast) join sys.triggers t with (readpast) on o.object_id = t.parent_id where o.type in( 'U' ) and t.is_disabled =10 1 and t.name != 'QBM_TUIndicator474488' )  and exists (select top 1 1 from sys.objects o with (readpast) join sys.triggers t with (readpast) on o.object_id11 = t.parent_id where o.type in( 'U' ) and t.is_disabled = 1 and t.name != 'QBM_TUIndicator474488' and o.name = 'DialogDatabase' )  and exists (select top12 1 1 from sys.tables t join sys.triggers tr on tr.parent_id = t.object_id where t.name = 'DialogDatabase' and tr.name = 'QBM_TUIndicator474488' ) begin13 alter table DialogDatabase enable Trigger QBM_TUIndicator474488 end  end END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR (@Rethrow, 1814, 1) WITH NOWAIT END CATCH endLabel: return @ret end 15