dbo.QBM_TIQBMGuidReplace
Database TriggerSQL_TRIGGERSandbox DB
Interpretation
- Database trigger. Treat parent table and enqueue/object-layer calls as the main relation points.
Relations
- Trigger parent table: QBMGuidReplace
Typed Edges
- trigger on table QBMGuidReplace Trigger parent table: QBMGuidReplace
- references source dbo.QBM_FGISessionContext source text reference
- references source dbo.QBM_PSessionErrorAdd source text reference
Complete Source
1CREATE trigger QBM_TIQBMGuidReplace2 ON QBMGuidReplace FOR3INSERT NOT FOR Replication4AS5BEGIN6 BEGIN TRY7 IF EXISTS(8 SELECT TOP 1 19 FROM inserted)10 GOTO start11 RETURN start:12 DECLARE @GenProcID varchar(38)13 SELECT @GenProcID = dbo.QBM_FGISessionContext('')14 IF EXISTS(15 SELECT TOP 1 116 FROM QBMDBQueueCurrent cu17 WITH(nolock)18 WHERE19 cu.SlotNumber <> 0 AND cu.UID_Task IN('QBM-K-TableReload', 'QBM-K-TableReplace')) OR EXISTS(20 SELECT TOP 1 121 FROM DialogDBQueue q22 WITH(nolock)23 WHERE24 q.UID_Task IN('QBM-K-TableReload', 'QBM-K-TableReplace', 'QBM-K-GUIDReplaceReady') AND q.Generation >= 0)25 BEGIN26 RAISERROR('#LDS#Making a replacement is impossible because of a running replacement job. Try again later.|',27 18,28 2)29 WITH nowait30 END31 IF EXISTS(32 SELECT TOP 1 133 FROM DialogDatabase d34 WITH(readpast)35 WHERE36 d.IsMainDatabase = 1 AND d.ProductionLevel = 2)37 BEGIN38 RAISERROR('#LDS#Making a replacement is not permitted in production environments.|',39 18,40 2)41 WITH nowait42 END43 END TRY44 BEGIN CATCH45 EXEC QBM_PSessionErrorAdd DEFAULT46 RAISERROR('',47 18,48 1)49 WITH NOWAIT50 END CATCH51END
Open raw exported source
1 create trigger QBM_TIQBMGuidReplace on QBMGuidReplace for Insert not for Replication as begin BEGIN TRY if exists (select top 1 1 from inserted2) goto start return start: declare @GenProcID varchar(38) select @GenProcID = dbo.QBM_FGISessionContext('') if exists (select top 1 1 from QBMDBQueueCurrent3 cu with (nolock) where cu.SlotNumber <> 0 and cu.UID_Task in ('QBM-K-TableReload' , 'QBM-K-TableReplace' ) ) or exists (select top 1 1 from DialogDBQueue4 q with(nolock) where q.UID_Task in ('QBM-K-TableReload' , 'QBM-K-TableReplace', 'QBM-K-GUIDReplaceReady' ) and q.Generation >= 0 ) begin raiserror('#LDS#Making a replacement is impossible because of a running replacement job. Try again later.|'5, 18, 2) with nowait end if exists (select top 1 1 from DialogDatabase d with (readpast) where d.IsMainDatabase = 1 and d.ProductionLevel = 2 ) begin 6raiserror('#LDS#Making a replacement is not permitted in production environments.|', 18, 2) with nowait end END TRY BEGIN CATCH exec QBM_PSessionErrorAdd7 default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH end 8