1

I have read that catching the particular exception separately enhanced the performance so I just wanted to know what are the most common exception that might generate while executing any sql query

1 Answer 1

2

It won't enhance performance, but exception handling provides a good way to control code flow.

The best article (the subject is too long for an SO answer) is "Error Handling in SQL 2005 and Later" by Erland Sommarskog. And shameless plug of my question here

However, if you mean in c# then there is really only SQLException.

As to what causes them, the main ones may be

  • constraint violation (fails CHECK, duplicate/UNIQUE, no parent/FK etc)
  • overflow and conversions (eg -1 to tinyint)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.