CREATE PROCEDURETestProc_TRY_CATCH
( )
WITH NATIVE_COMPILATION, SCHEMABINDING,
EXECUTE ASOWNER
AS
BEGIN ATOMIC WITH
(
TRANSACTION ISOLATIONLEVEL = SNAPSHOT,
LANGUAGE = N'English'
)
BEGIN TRY
DECLARE @myInt AS INT = 'Error Test'
END TRY
BEGIN CATCH
SELECT
ERROR_SEVERITY() AS ErrorSeverity,
ERROR_STATE() AS ErrorState,
ERROR_PROCEDURE() AS ErrorProcedure,
ERROR_LINE() AS ErrorLine,
ERROR_MESSAGE() AS ErrorMessage
END CATCH
END