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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

EugeneZ ZhitomirskySQL SERVER EXPERTCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.