I want to know , If I can catch all errors occurred in my database and log it to some user defined table.
Reason:
Why I am as so is that, I have web-app running with Sql2005
as backend. Web app is developed using Linq2Sql
. It was developed on 2008R2
where as deployed over Sql2005
on a Shared Hosting environment
.
I am continuously getting datetime datatype
error, as in 2008 i have used date datatype
.
So, what I want is to catch any similar exceptions internally , occurred anywhere in my database and log it to my custom table with fields
Requirements
- Table Name from where the exception has been thrown
- Name of Procedure, in case if I use it in future
- Exception message
- Date time of occurrence
Please Note
I dont want to write tablewise exception handling procedures. I want some generic way to get all exceptions, as same as we handle errors in ASP.Net , Global.asax.
Exception I am getting
The version of SQL Server in use does not support datatype 'date'.
based on above exception, I am not sure which table is throwing this exception. So I want a stored procedure to catch the detail and save to my custom table.