/ Published in: SQL

Boiler Plate for T-Sql Error handling
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
BEGIN TRY BEGIN TRAN COMMIT TRAN END TRY BEGIN CATCH DECLARE @ErrorMessage VARCHAR(2000) = (SELECT ERROR_MESSAGE()) DECLARE @ErrorSeverity INT = (SELECT ERROR_SEVERITY()) DECLARE @ErrorState INT = (SELECT ERROR_STATE()) ROLLBACK TRANSATION RAISERROR(@ErrorMessage, @ErrorSeverity, @ErrorState) END CATCH
Comments
