Error Handling

Hi All,

I am using sql server 2014. I would like to know what are the best ways of error handling while querying sql server for CRUD operations and stored procedures. This is for enterprise web application. I would like a suggestion or kind of guidelines that would make use of latest features 2014 edition has to offer. If any features are not available in 2012 i would like to know too.

Thanks for your time.
JyozealAsked:
Who is Participating?
 
Eugene ZCommented:
use TRY…CATCH

and starting sql 2012

you can use
THROW statement (Transact-SQL)

it raises an exception and transfers execution to a CATCH block of a TRY…CATCH construct in SQL Server 2014.

https://msdn.microsoft.com/en-us/library/ee677615.aspx

more:
New THROW statement in SQL Server 2012 (vs RAISERROR)
http://blogs.msdn.com/b/manub22/archive/2013/12/31/new-throw-statement-in-sql-server-2012-vs-raiserror.aspx


more see  examples
Handling Errors in SQL Server 2012
https://www.simple-talk.com/sql/database-administration/handling-errors-in-sql-server-2012/




Structured Error Handling Mechanism in SQL Server 2012
http://social.technet.microsoft.com/wiki/contents/articles/20002.structured-error-handling-mechanism-in-sql-server-2012.aspx
0
 
Vitor MontalvãoMSSQL Senior EngineerCommented:
Jyozeal, do you still need help with this question?
0
 
JyozealAuthor Commented:
I think i am good, i was like kind of developing a checklist for error handling in database development. So i though more answers will be helpful.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.