Try Catch Except
ID | 214 |
---|---|
Link Reference | Not set |
Link Credits | Not set |
Link Technical Documentation | Not set |
PlCodelang | T-SQL |
PlGroup | Exceptions |
PlItemTitle | Try Catch Except |
Code | -- See also: http://msdn.microsoft.com/de-de/library/ms175976(v=sql.105).aspx -- !! -- TRY-CATCH cannot be used for all operations/situations in T-SQL. -- Be careful and refer to the link above for details -- !! BEGIN TRY SELECT 1/0; END TRY BEGIN CATCH SELECT ERROR_NUMBER() AS ErrorNumber ,ERROR_SEVERITY() AS ErrorSeverity ,ERROR_STATE() AS ErrorState ,ERROR_PROCEDURE() AS ErrorProcedure ,ERROR_LINE() AS ErrorLine ,ERROR_MESSAGE() AS ErrorMessage; END CATCH; |
Result Example |