Back to OIM Explorer

dbo.DPR_PTriggerCreateMembership

Stored ProcedureSQL_STORED_PROCEDURESandbox DB

Stored Procedure.

Source: sandbox-db sys.sql_modules

Source size: 2.938 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.DPR_FSQTriggerRIMemberShip source text reference
  • references source dbo.DPR_FSQTriggerWatchMemberShip source text reference
  • references source dbo.QBM_FGIIsSimulationMode source text reference
  • references source dbo.QBM_FGISessionErrorRethrow source text reference
  • references source dbo.QBM_FSQTriggerDef source text reference
  • references source dbo.QBM_PSessionErrorAdd source text reference
  • references source dbo.QBM_PSQLCreate source text reference
  • references source dbo.QBM_PTriggerDrop source text reference

Complete Source

SQL137 lines
1CREATE PROCEDURE DPR_PTriggerCreateMembership(2  @TableName varchar(30),3  @Operation varchar(16),4  @TriggerName varchar(30)5)6AS7BEGIN8  DECLARE @TriggerBody nvarchar(max)9  DECLARE @SQLcmd nvarchar(max)10  DECLARE @tabletype nvarchar(1)11  DECLARE @DebugLevel char(1) = 'W'12  DECLARE @DebugMessage nvarchar(4000)13  DECLARE @DebugSwitch int = 014  DECLARE @IsDeactivatedByPreProcessor BIT15  DECLARE @VarDeclaration nvarchar(max) = '16	 declare  @IsSimulationMode bit = dbo.QBM_FGIIsSimulationMode()17	 declare @TrackingDate datetime = getutcdate()18	 declare @SimulationModeBuffer QBM_YTriggerOperation19 '20  SET XACT_ABORT OFF21  BEGIN TRY22    SELECT23      TOP 1 @tabletype = t.TableType,24      @IsDeactivatedByPreProcessor = t.IsDeactivatedByPreProcessor25    FROM DialogTable t26      WITH(readpast)27    WHERE28      TableName = @TableName29    IF @tabletype <> 'T' OR @TableName IN(30      SELECT TableName31      FROM QBM_VHeavyLoadTables) OR @IsDeactivatedByPreProcessor = 1 OR NOT EXISTS(32    SELECT TOP 1 133    FROM information_schema.tables34    WHERE35      table_name = @TableName AND table_type IN('BASE TABLE', 'VIEW'))36    BEGIN37      GOTO dropOnly38    END39    SELECT40      @TriggerBody = dbo.DPR_FSQTriggerWatchMemberShip(@TableName,41      @operation)42    IF @TriggerBody LIKE '--Debug%'43    BEGIN44      IF @DebugSwitch > 045      BEGIN46        print @TriggerBody47      END48      SELECT @TriggerBody = ''49    END50    SELECT51      @TriggerBody = @TriggerBody + dbo.DPR_FSQTriggerRIMemberShip(@TableName,52      @operation)53    IF @triggerbody > ' '54    BEGIN55      SELECT56        @SQLcmd = dbo.QBM_FSQTriggerDef(@TriggerName,57        @TableName,58        @Operation,59        @TriggerBody,60        @VarDeclaration,61        'Trigger DPRMembership for ' + @TableName + '(' + @Operation + ')')62      IF @DebugSwitch > 063      BEGIN64        print substring(@SQLcmd,65        1,66        4000) print substring(@SQLcmd,67        4001,68        4000) print substring(@SQLcmd,69        8001,70        4000) print substring(@SQLcmd,71        12001,72        4000) print substring(@SQLcmd,73        16001,74        4000) print substring(@SQLcmd,75        20001,76        4000) print substring(@SQLcmd,77        24001,78        4000) print substring(@SQLcmd,79        28001,80        4000) print substring(@SQLcmd,81        32001,82        4000) print substring(@SQLcmd,83        36001,84        4000) print substring(@SQLcmd,85        40001,86        4000) print substring(@SQLcmd,87        44001,88        4000) print substring(@SQLcmd,89        48001,90        4000) print substring(@SQLcmd,91        52001,92        4000) print substring(@SQLcmd,93        56001,94        4000) print substring(@SQLcmd,95        60001,96        4000) print substring(@SQLcmd,97        64001,98        4000) print substring(@SQLcmd,99        68001,100        4000) print substring(@SQLcmd,101        72001,102        4000) print substring(@SQLcmd,103        76001,104        4000) print substring(@SQLcmd,105        80001,106        4000) print substring(@SQLcmd,107        84001,108        4000) print substring(@SQLcmd,109        88001,110        4000) print substring(@SQLcmd,111        92001,112        4000) print substring(@SQLcmd,113        96001,114        4000)115      END116      EXEC QBM_PSQLCreate @TriggerName,117      'T',118        @SQLcmd,119        @UnComment = 0120    END121    ELSE122    BEGIN123      EXEC QBM_PTriggerDrop @TriggerName124    END125  END TRY126  BEGIN CATCH127    EXEC QBM_PSessionErrorAdd DEFAULT128    DECLARE @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow()129    RAISERROR(@Rethrow,130    18,131    1)132      WITH NOWAIT133  END CATCH134  ende:135  RETURN dropOnly:136  EXEC QBM_PTriggerDrop @TriggerName137END
Open raw exported source
SQL ยท Raw23 lines
1               create   procedure DPR_PTriggerCreateMembership (@TableName varchar(30)   , @Operation varchar(16)  , @TriggerName varchar(30) ) 2as begin declare @TriggerBody nvarchar(max) declare @SQLcmd nvarchar(max) declare @tabletype nvarchar(1) declare @DebugLevel char(1) = 'W' declare @DebugMessage3 nvarchar(4000) declare @DebugSwitch int = 0 declare @IsDeactivatedByPreProcessor bit declare @VarDeclaration nvarchar(max) = '4	 declare  @IsSimulationMode bit = dbo.QBM_FGIIsSimulationMode()5	 declare @TrackingDate datetime = getutcdate()6	 declare @SimulationModeBuffer QBM_YTriggerOperation7 '8 SET XACT_ABORT OFF BEGIN TRY select top 1 @tabletype = t.TableType , @IsDeactivatedByPreProcessor = t.IsDeactivatedByPreProcessor from DialogTable t with9 (readpast) where TableName = @TableName if @tabletype <> 'T' or @TableName in (select TableName from QBM_VHeavyLoadTables  ) or @IsDeactivatedByPreProcessor10 = 1 or not exists (select top 1 1 from information_schema.tables where table_name = @TableName and table_type in ('BASE TABLE', 'VIEW') ) begin goto dropOnly11 end select @TriggerBody = dbo.DPR_FSQTriggerWatchMemberShip(@TableName, @operation) if @TriggerBody like '--Debug%' begin if @DebugSwitch > 0 begin print12 @TriggerBody end select @TriggerBody = '' end select @TriggerBody = @TriggerBody + dbo.DPR_FSQTriggerRIMemberShip(@TableName, @operation) if @triggerbody13 > ' ' begin select @SQLcmd = dbo.QBM_FSQTriggerDef (@TriggerName , @TableName , @Operation , @TriggerBody , @VarDeclaration , 'Trigger DPRMembership for '14 + @TableName + '(' + @Operation + ')' ) if @DebugSwitch > 0 begin print substring(@SQLcmd, 1, 4000) print substring(@SQLcmd, 4001, 4000) print substring15(@SQLcmd, 8001, 4000) print substring(@SQLcmd, 12001, 4000) print substring(@SQLcmd, 16001, 4000) print substring(@SQLcmd, 20001, 4000) print substring16(@SQLcmd, 24001, 4000) print substring(@SQLcmd, 28001, 4000) print substring(@SQLcmd, 32001, 4000) print substring(@SQLcmd, 36001, 4000) print substring17(@SQLcmd, 40001, 4000) print substring(@SQLcmd, 44001, 4000) print substring(@SQLcmd, 48001, 4000) print substring(@SQLcmd, 52001, 4000) print substring18(@SQLcmd, 56001, 4000) print substring(@SQLcmd, 60001, 4000) print substring(@SQLcmd, 64001, 4000) print substring(@SQLcmd, 68001, 4000) print substring19(@SQLcmd, 72001, 4000) print substring(@SQLcmd, 76001, 4000) print substring(@SQLcmd, 80001, 4000) print substring(@SQLcmd, 84001, 4000) print substring20(@SQLcmd, 88001, 4000) print substring(@SQLcmd, 92001, 4000) print substring(@SQLcmd, 96001, 4000) end  exec QBM_PSQLCreate @TriggerName, 'T', @SQLcmd,21 @UnComment = 0 end else begin exec QBM_PTriggerDrop @TriggerName end END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default declare @Rethrow varchar(100022) = dbo.QBM_FGISessionErrorRethrow() RAISERROR (@Rethrow, 18, 1) WITH NOWAIT END CATCH ende: return dropOnly: exec QBM_PTriggerDrop @TriggerName end 23