April 29, 2008 at 11:34 am
Hi All,
I am using SQL Server 2000. When an error happens in my stored proc, the process exits from the line of the code where error occurs so there is no way of knowing what the error was. I have used code like:
if @@error <> 0
begin
set @step = 'error description'
goto err
end
but it is not working. Can you help?
Thanks.
April 30, 2008 at 6:52 am
Try your stored proc step by step and print message e.g. "Step1 completed" and / or "step1 started" for every possible step.
Also you can use profiler for further investigation.
Good Luck!
---------------------------------------------------
"Thare are only 10 types of people in the world:
Those who understand binary, and those who don't."
April 30, 2008 at 12:44 pm
Thanks, SSRookie.
April 30, 2008 at 12:59 pm
Put the error code into a variable so you can return it.
SET @SQLError = @@ERROR
IF @SQLError <> 0 .......
You can then later query @SQLError and get the actual error number. Is this what you are after?
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply