Back to OIM Explorer

dbo.QBM_ZConstraintEnable

Stored ProcedureSQL_STORED_PROCEDURESandbox DB

Stored Procedure. Single DBQueue insert -> QBM-K-QBMConstraintEnable2 / QBM_ZConstraintEnable at line 16; References QBM_PDBQueueInsert_Single

Source: sandbox-db sys.sql_modules

Source size: 2.861 characters

Interpretation

  • Database routine. Review parameters, called procedures, DBQueue inserts, and QBM_PJobCreate helper calls before assuming side effects.
  • DBQueue relation detected. Follow the task procedure and referenced-by list for async processing.

Relations

  • Single DBQueue insert -> QBM-K-QBMConstraintEnable2 / QBM_ZConstraintEnable at line 16
  • References QBM_PDBQueueInsert_Single

Typed Edges

  • queues DBQueue task QBM_ZConstraintEnable at line 16 Single DBQueue insert -> QBM-K-QBMConstraintEnable2 / QBM_ZConstraintEnable at line 16
  • references source dbo.QBM_FGIDBQueueSlotResetType source text reference
  • references source dbo.QBM_FGISessionErrorForLog source text reference
  • references source dbo.QBM_PConstraintEnable source text reference
  • references source dbo.QBM_PDBQCS_CurrentMoveSlot source text reference
  • references source dbo.QBM_PDBQueueInsert_Single source text reference
  • references source dbo.QBM_PJournal source text reference
  • references source dbo.QBM_PSessionErrorAdd source text reference
  • references source dbo.QBM_PSessionErrorClean source text reference
  • references source dbo.QBM_PTriggerEnable source text reference
  • references source dbo.QBM_ZConstraintDisable source text reference
  • references source dbo.QBM_TUIndicator474488 source text reference
  • queues DBQueue task QBM-K-QBMConstraintEnable2 -> QBM_ZConstraintEnable QBM_PDBQueueInsert_Single 'QBM-K-QBMConstraintEnable2', '', '', @GenProcID exec QBM_PJournal 'Triggers und / oder constraints nicht geklappt, wieder eingestellt' , @@procid, 'D', @DebugLevel end end else begin exec QBM_PJournal 'Triggers a…

Complete Source

SQL128 lines
1CREATE PROCEDURE QBM_ZConstraintEnable(2  @SlotNumber int,3  @dummy1 varchar(38),4  @dummy2 varchar(38),5  @GenProcID varchar(38)6)7AS8BEGIN9  DECLARE @ProcedureDisable varchar(30) = 'QBM_ZConstraintDisable'10  DECLARE @TasksDisable QBM_YSingleGUID11  DECLARE @DebugLevel char(1) = 'W'12  DECLARE @WarFehlerhaftT int13  DECLARE @WarFehlerhaftC int14  DECLARE @UID_MeineTask varchar(38)15  DECLARE @SlotNumberSource int16  DECLARE @SlotNumberTarget int17  DECLARE @DBQueueToMove QBM_YDBQCSCurrentToMove18  DECLARE @RowsMoved int19  BEGIN TRY20    SELECT TOP 1 @UID_MeineTask = s.UID_Task21    FROM QBMDBQueueCurrent s22      WITH(nolock)23    WHERE24      s.SlotNumber = @SlotNumber25    IF @UID_MeineTask = 'QBM-K-QBMConstraintEnable'26    BEGIN27      INSERT INTO @TasksDisable(UID_SingleGuid)28      SELECT 'QBM-K-QBMConstraintDisable'29    END30    IF @UID_MeineTask = 'QBM-K-QBMConstraintEnable2'31    BEGIN32      INSERT INTO @TasksDisable(UID_SingleGuid)33      SELECT 'QBM-K-QBMConstraintDisable'34      UNION35      SELECT 'QBM-K-QBMConstraintDisable2'36    END37    IF EXISTS(38      SELECT TOP 1 139      FROM DialogDBQueue q40      WITH(nolock)41    WHERE42      q.UID_Task IN(43    SELECT td.UID_SingleGuid44    FROM @TasksDisable td) AND q.Generation >= 0) OR EXISTS(45    SELECT TOP 1 146    FROM QBMDBQueueCurrent q47      WITH(nolock)48    WHERE49      q.UID_Task IN(50    SELECT td.UID_SingleGuid51    FROM @TasksDisable td) AND q.SlotNumber <> 0)52    BEGIN53      DELETE @DBQueueToMove54      INSERT INTO @DBQueueToMove(UID_DialogDBQueue)55      SELECT cul.UID_DialogDBQueue56      FROM QBMDBQueueCurrent cul57        WITH(readpast)58      WHERE59        @SlotNumber = @SlotNumber60      IF @@ROWCOUNT > 061      BEGIN62        SELECT @SlotNumberSource = @SlotNumber63        SELECT @SlotnumberTarget = dbo.QBM_FGIDBQueueSlotResetType('DBQueue')64        EXEC @RowsMoved = QBM_PDBQCS_CurrentMoveSlot @DBQueueToMove,65          @SlotNumberSource,66          @SlotnumberTarget67        EXEC QBM_PJournal 'erst mal nichst gemacht, nächstes Disable steht schon bereit',68          @@procid,69        'D',70          @DebugLevel71        GOTO endLabel72      END73    END74    IF NOT EXISTS(75      SELECT TOP 1 176      FROM sys.triggers x77      WHERE78        x.is_disabled = 1 AND x.name != 'QBM_TUIndicator474488') AND NOT EXISTS(79    SELECT TOP 1 180    FROM sys.foreign_keys x81    WHERE82      x.is_disabled = 1)83    BEGIN84      GOTO endLabel85    END86    EXEC QBM_PSessionErrorClean87    EXEC @WarFehlerhaftT = QBM_PTriggerEnable '%',88      @HandleErrorSilent = 189    EXEC @WarFehlerhaftC = QBM_PConstraintEnable '%',90      @HandleErrorSilent = 191    IF @WarFehlerhaftT + @WarFehlerhaftC > 092    BEGIN93      IF dbo.QBM_FGISessionErrorForLog() LIKE '%547%ALTER TABLE statement conflicted with the FOREIGN KEY constraint%'94      BEGIN95        RAISERROR('',96        18,97        1)98          WITH NOWAIT99      END100      ELSE101      BEGIN102        EXEC QBM_PDBQueueInsert_Single 'QBM-K-QBMConstraintEnable2',103        '',104        '',105          @GenProcID106        EXEC QBM_PJournal 'Triggers und / oder constraints nicht geklappt, wieder eingestellt',107          @@procid,108        'D',109          @DebugLevel110      END111    END112    ELSE113    BEGIN114      EXEC QBM_PJournal 'Triggers and constraints enabled',115        @@procid,116      'D',117        @DebugLevel118    END119  END TRY120  BEGIN CATCH121    EXEC QBM_PSessionErrorAdd DEFAULT122    RAISERROR('',123    18,124    1)125      WITH NOWAIT126  END CATCH127  endLabel:128END
Open raw exported source
SQL · Raw19 lines
1    create   procedure QBM_ZConstraintEnable ( @SlotNumber int , @dummy1 varchar(38) , @dummy2 varchar(38) , @GenProcID varchar(38) ) as begin  2declare @ProcedureDisable varchar(30) = 'QBM_ZConstraintDisable'  declare @TasksDisable QBM_YSingleGUID  declare @DebugLevel char(1) = 'W' declare @WarFehlerhaftT3 int declare @WarFehlerhaftC int declare @UID_MeineTask varchar(38) declare @SlotNumberSource int declare @SlotNumberTarget int declare @DBQueueToMove 4QBM_YDBQCSCurrentToMove declare @RowsMoved int BEGIN TRY select top 1 @UID_MeineTask = s.UID_Task from QBMDBQueueCurrent  s with (nolock) where s.SlotNumber5 = @SlotNumber if @UID_MeineTask = 'QBM-K-QBMConstraintEnable' begin insert into @TasksDisable(UID_SingleGuid ) select 'QBM-K-QBMConstraintDisable' end6 if @UID_MeineTask = 'QBM-K-QBMConstraintEnable2' begin insert into @TasksDisable(UID_SingleGuid ) select 'QBM-K-QBMConstraintDisable' union select 'QBM-K-QBMConstraintDisable2'7 end if exists (select top 1 1 from DialogDBQueue q with (nolock) where q.UID_Task in (select td.UID_SingleGuid  from @TasksDisable td)  and q.Generation8 >= 0 ) or exists (select top 1 1 from QBMDBQueueCurrent q with (nolock) where q.UID_Task in (select td.UID_SingleGuid from @TasksDisable td) and q.SlotNumber9 <> 0 ) begin   delete @DBQueueToMove  insert into @DBQueueToMove(UID_DialogDBQueue) select cul.UID_DialogDBQueue from QBMDBQueueCurrent cul with (readpast10)  where @SlotNumber = @SlotNumber if @@ROWCOUNT > 0 begin select @SlotNumberSource = @SlotNumber  select @SlotnumberTarget = dbo.QBM_FGIDBQueueSlotResetType11('DBQueue') exec @RowsMoved = QBM_PDBQCS_CurrentMoveSlot @DBQueueToMove, @SlotNumberSource, @SlotnumberTarget exec QBM_PJournal 'erst mal nichst gemacht, nächstes Disable steht schon bereit'12, @@procid, 'D', @DebugLevel goto endLabel end end   if not exists (select top 1 1 from sys.triggers x where x.is_disabled = 1 and x.name != 'QBM_TUIndicator474488'13 ) and not exists (select top 1 1 from sys.foreign_keys x where x.is_disabled = 1 ) begin goto endLabel end exec QBM_PSessionErrorClean exec @WarFehlerhaftT14 = QBM_PTriggerEnable '%' , @HandleErrorSilent = 1 exec @WarFehlerhaftC = QBM_PConstraintEnable '%', @HandleErrorSilent = 1 if @WarFehlerhaftT + @WarFehlerhaftC15 > 0 begin  if dbo.QBM_FGISessionErrorForLog() like '%547%ALTER TABLE statement conflicted with the FOREIGN KEY constraint%' begin RAISERROR ('', 18, 116) WITH NOWAIT end else begin exec QBM_PDBQueueInsert_Single 'QBM-K-QBMConstraintEnable2', '', '', @GenProcID exec QBM_PJournal 'Triggers und / oder constraints nicht geklappt, wieder eingestellt'17, @@procid, 'D', @DebugLevel end end else begin exec QBM_PJournal 'Triggers and constraints enabled', @@procid, 'D', @DebugLevel end END TRY BEGIN CATCH18 exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH endLabel: end 19