dbo.QBM_PCustomSQLPropagate_Cont
Stored ProcedureSQL_STORED_PROCEDURESandbox DB
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_PCustomSQLPropagate source text reference
- references source dbo.QBM_PExecuteSQLWithRetry_LLP source text reference
- references source dbo.QBM_PSessionErrorAdd source text reference
References
Referenced By
Complete Source
1CREATE PROCEDURE QBM_PCustomSQLPropagate_Cont(2 @UID_QBMCustomSQL varchar(38),3 @Objectname nvarchar(255) = N ''4)5AS6BEGIN7 DECLARE @ObjectName_intern nvarchar(255)8 DECLARE @Content nvarchar(max)9 DECLARE @ErrorMessage nvarchar(4000)10 DECLARE @ErrorSeverity int11 DECLARE @DebugSwitch int = 012 DECLARE @ErrorBuffer QBM_YSessionError13 SET XACT_ABORT OFF14 BEGIN TRY15 IF @DebugSwitch > 016 BEGIN17 print @UID_QBMCustomSQL + '#' + @Objectname18 END19 SELECT @ErrorSeverity = 020 SELECT @ObjectName_intern = @ObjectName21 IF isnull(@ObjectName,22 N '') = N ''23 BEGIN24 SELECT @ObjectName_intern = N '<unknown name>'25 END26 SELECT TOP 1 @content = Scriptcode27 FROM QBMCustomSQL28 WHERE29 UID_QBMCustomSQL = @UID_QBMCustomSQL30 IF @DebugSwitch > 031 BEGIN32 print isnull(@content,33 '<no content>')34 END35 BEGIN TRY36 IF EXISTS(37 SELECT TOP 1 138 FROM sys.procedures p39 WHERE40 p.name = 'QBM_PExecuteSQLWithRetry_LLP')41 BEGIN42 EXEC QBM_PExecuteSQLWithRetry_LLP @SQLStatement = @content,43 @LockTimeout_ms = 10000,44 @MaxWaitTimeForLock_s = 60,45 @ProcIDForJournal = DEFAULT,46 @HandleErrorSilent = 0,47 @DeadlockPriority = 848 END49 ELSE50 BEGIN51 EXEC sp_executesql @content52 END53 END TRY54 BEGIN CATCH55 SELECT @ErrorSeverity = 1856 SELECT57 @ErrorMessage =concat(N 'Could not propagate CustomSQL : ',58 @Objectname,59 nchar(13),60 nchar(10),61 isnull(ERROR_MESSAGE(), '<no message>'))62 END CATCH63 END TRY64 BEGIN CATCH65 SELECT @ErrorSeverity = 1866 SELECT67 @ErrorMessage = isnull(ERROR_MESSAGE(),68 '<no message>')69 SELECT70 @ErrorMessage = CONCAT('#LDS#Error adding {0}.|',71 @ObjectName_intern,72 N '|',73 nchar(13),74 nchar(10),75 @ErrorMessage)76 DELETE @ErrorBuffer77 INSERT INTO @ErrorBuffer(ErrorMessage,78 ErrorSeverity,79 ErrorState,80 ErrorNumber,81 ProcedureName,82 ProcedureLine,83 MessageDate,84 GenProcID,85 RepeatCounter,86 IsReThrow,87 SourceCode)88 SELECT89 @ErrorMessage,90 @ErrorSeverity,91 ERROR_STATE(),92 ERROR_NUMBER(),93 ERROR_PROCEDURE(),94 ERROR_LINE(),95 GETUTCDATE(),96 NULL,97 0,98 0,99 NULL100 EXEC QBM_PSessionErrorAdd @ErrorBuffer101 RAISERROR(@ErrorMessage,102 @ErrorSeverity,103 1)104 WITH NOWAIT105 END CATCH106 IF @ErrorSeverity > 12 OR(XACT_STATE()) = -1107 BEGIN108 DELETE @ErrorBuffer109 INSERT INTO @ErrorBuffer(ErrorMessage,110 ErrorSeverity,111 ErrorState,112 ErrorNumber,113 ProcedureName,114 ProcedureLine,115 MessageDate,116 GenProcID,117 RepeatCounter,118 IsReThrow,119 SourceCode)120 SELECT121 @ErrorMessage,122 @ErrorSeverity,123 1,124 50000,125 object_name(@@PROCID),126 187,127 GETUTCDATE(),128 NULL,129 0,130 0,131 NULL132 EXEC QBM_PSessionErrorAdd @ErrorBuffer133 RAISERROR(@ErrorMessage,134 @ErrorSeverity,135 1)136 WITH NOWAIT137 END138END
Open raw exported source
1 create procedure QBM_PCustomSQLPropagate_Cont (@UID_QBMCustomSQL varchar(38), @Objectname nvarchar(255) = N'') as begin declare @ObjectName_intern2 nvarchar(255) declare @Content nvarchar(max) declare @ErrorMessage nvarchar(4000) declare @ErrorSeverity int declare @DebugSwitch int = 0 declare @ErrorBuffer3 QBM_YSessionError SET XACT_ABORT OFF BEGIN TRY if @DebugSwitch > 0 begin print @UID_QBMCustomSQL + '#' + @Objectname end select @ErrorSeverity = 0 select4 @ObjectName_intern = @ObjectName if isnull(@ObjectName, N'') = N'' begin select @ObjectName_intern = N'<unknown name>' end SELECT top 1 @content =5 Scriptcode FROM QBMCustomSQL where UID_QBMCustomSQL = @UID_QBMCustomSQL if @DebugSwitch > 0 begin print isnull(@content, '<no content>') end begin try6 if exists (select top 1 1 from sys.procedures p where p.name = 'QBM_PExecuteSQLWithRetry_LLP' ) begin exec QBM_PExecuteSQLWithRetry_LLP @SQLStatement7 = @content , @LockTimeout_ms = 10000 , @MaxWaitTimeForLock_s = 60 , @ProcIDForJournal = default , @HandleErrorSilent = 0 , @DeadlockPriority = 8 end8 else begin exec sp_executesql @content end end try begin catch select @ErrorSeverity = 18 select @ErrorMessage =concat( N'Could not propagate CustomSQL : '9 , @Objectname , nchar(13) , nchar(10) , isnull(ERROR_MESSAGE() , '<no message>') ) end catch END TRY BEGIN CATCH select @ErrorSeverity = 18 select @ErrorMessage10 = isnull(ERROR_MESSAGE() , '<no message>') select @ErrorMessage = concat('#LDS#Error adding {0}.|' , @ObjectName_intern , N'|' , nchar(13) , nchar(10)11 , @ErrorMessage ) delete @ErrorBuffer insert into @ErrorBuffer (ErrorMessage, ErrorSeverity, ErrorState, ErrorNumber , ProcedureName, ProcedureLine,12 MessageDate , GenProcID, RepeatCounter, IsReThrow, SourceCode) select @ErrorMessage, @ErrorSeverity, ERROR_STATE(), ERROR_NUMBER() , ERROR_PROCEDURE()13, ERROR_LINE(), GETUTCDATE() , null, 0, 0, null exec QBM_PSessionErrorAdd @ErrorBuffer RAISERROR (@ErrorMessage, @ErrorSeverity, 1) WITH NOWAIT END CATCH14 if @ErrorSeverity > 12 or (XACT_STATE()) = -1 begin delete @ErrorBuffer insert into @ErrorBuffer (ErrorMessage, ErrorSeverity, ErrorState, ErrorNumber15 , ProcedureName, ProcedureLine, MessageDate , GenProcID, RepeatCounter, IsReThrow, SourceCode) select @ErrorMessage, @ErrorSeverity, 1, 50000 , object_name16(@@PROCID), 187, GETUTCDATE() , null, 0, 0, null exec QBM_PSessionErrorAdd @ErrorBuffer RAISERROR (@ErrorMessage, @ErrorSeverity, 1) WITH NOWAIT end end17 18