hi,I have created 2 tables as below...
Then i have created a procedure dbo.sp_sales_insert to insert records into sales table and incase any exception i need to have log the exception in Error_Log table.
i have excecuted the above procedure as below
im not able to capture the exception in the error_log in the second case.can anybody give best examples to capture the exception in Error_Log table????
Is this the entire procedure?
What version of SQL-Server are you using?
If SQL 2005, I recommend using a try..catch block instead.
SQL 2000 example
I think your goto statements might be conflicting with the error logging.
answered Mar 12, 2010 at 03:18 AM
Your sp_sales_insert looks good to me, although you should look at TRY CATCH if you're on SQL 2005 or 2008. So sp_emp_insert must have something wrong. Can you add the code for that proc to your post?
answered Mar 12, 2010 at 05:15 AM