Error trapping in SQL Server 2005 [modified]
-
Hello, I have not really coded for error trapping the past since the applications were not that big. Currently, the app being worked on is huge with multiple phases development. I wanted to find out the best practices for error trapping, some simple forms and some more complex ones. I need to start using them It is also ok, to write them to the database tables if possible. I know I can google this as well but some times it takes a longer amount of time to find the correct link/article. Thank you for your time!
modified on Monday, August 1, 2011 3:43 PM
-
Hello, I have not really coded for error trapping the past since the applications were not that big. Currently, the app being worked on is huge with multiple phases development. I wanted to find out the best practices for error trapping, some simple forms and some more complex ones. I need to start using them It is also ok, to write them to the database tables if possible. I know I can google this as well but some times it takes a longer amount of time to find the correct link/article. Thank you for your time!
modified on Monday, August 1, 2011 3:43 PM
There is no way to trap everything. And it is non-sensical as well. So you need to determine some actual implementation cases where it is reasonable.
vanikanc wrote:
It is also ok, to write them to the database tables if possible.
Still depends on what you mean by error. It is certainly possible for some cases. Also why is this just a database relevant question? If the system is large then there will be other parts of the system which will fail in relation to the database. For example bouncing the database is very likely to cause ripple failures in a 24x7 system unless those other systems are specifically designed to deal with that.
-
There is no way to trap everything. And it is non-sensical as well. So you need to determine some actual implementation cases where it is reasonable.
vanikanc wrote:
It is also ok, to write them to the database tables if possible.
Still depends on what you mean by error. It is certainly possible for some cases. Also why is this just a database relevant question? If the system is large then there will be other parts of the system which will fail in relation to the database. For example bouncing the database is very likely to cause ripple failures in a 24x7 system unless those other systems are specifically designed to deal with that.
-
Hello, I have not really coded for error trapping the past since the applications were not that big. Currently, the app being worked on is huge with multiple phases development. I wanted to find out the best practices for error trapping, some simple forms and some more complex ones. I need to start using them It is also ok, to write them to the database tables if possible. I know I can google this as well but some times it takes a longer amount of time to find the correct link/article. Thank you for your time!
modified on Monday, August 1, 2011 3:43 PM
-
Hello, I have not really coded for error trapping the past since the applications were not that big. Currently, the app being worked on is huge with multiple phases development. I wanted to find out the best practices for error trapping, some simple forms and some more complex ones. I need to start using them It is also ok, to write them to the database tables if possible. I know I can google this as well but some times it takes a longer amount of time to find the correct link/article. Thank you for your time!
modified on Monday, August 1, 2011 3:43 PM
All the data validation is done in the business layer so the data hitting the database is clean and I write perfect stored procedures so I don't need error trapping in the database. Once a procedure is coded it generally does not break unless there is a change in structure. The few cases where I can identify this may be prevalent is where I use try/catch structures. I do have a trigger based logging system but that is not error trapping.
Never underestimate the power of human stupidity RAH
-
Hello, I have not really coded for error trapping the past since the applications were not that big. Currently, the app being worked on is huge with multiple phases development. I wanted to find out the best practices for error trapping, some simple forms and some more complex ones. I need to start using them It is also ok, to write them to the database tables if possible. I know I can google this as well but some times it takes a longer amount of time to find the correct link/article. Thank you for your time!
modified on Monday, August 1, 2011 3:43 PM
vanikanc wrote:
I know I can google this as well but some times it takes a longer amount of time to find the correct link/article.
Then give a shot in CP. Overview of Error Handling in SQL Server 2005[^] A Closer Look Inside RAISERROR - SQLServer 2005 [^]
thatraja
**My Tip/Tricks
My Dad had a Heart Attack on this day so don't...
** -
Even if there are some scenarios i would like to trap for, which syntax would I use? Like C# has a Try, Catch, Finally block I use for displaying som error messgaes.
SQL server has try/catch. But you need to be careful with it. One might think that they could put that in every proc as thus record errors but I am rather certain that in many procs the errors that might occur would be the ones that would be compounded by attempting another write to the database. For example a table space error.