I want to know that can we use concept of exception handling in SQL server. If yes then how ?
Thank you.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jignesh TrivediPosted Aug 27, 2012, 8:01 AM
Yes you can use try catch block in SQL server for exception handling.
BEGIN TRY
-- sql sTATEMENT
END TRY
BEGIN CATCH
SELECT
ERROR_NUMBER() as ErrorNumber,
ERROR_MESSAGE() as ErrorMessage;
END CATCH
Please refer...
http://msdn.microsoft.com/en-us/library/ms175976%28v=sql.90%29.aspx
http://blog.sqlauthority.com/2007/04/11/sql-server-2005-explanation-of-trycatch-and-error-handling/