fix(inputs.sqlserver): Converted THROW to RAISERROR for 2008 compatibility

This commit is contained in:
Gianluca Sartori 2023-04-03 15:19:28 +02:00 committed by GitHub
parent f8a991b829
commit b75fa42d75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -1143,8 +1143,12 @@ BEGIN TRY
EXEC sp_executesql @SqlStatement
END TRY
BEGIN CATCH
SET @ErrorMessage = ERROR_MESSAGE();
DECLARE @ErrorSeverity INT = ERROR_SEVERITY();
DECLARE @ErrorState INT = ERROR_STATE();
IF (ERROR_NUMBER() <> 976) --Avoid possible errors from secondary replica
THROW;
RAISERROR (@ErrorMessage, @ErrorSeverity, @ErrorState );
END CATCH
`