Hi
Went looking for information on how to handle errors in SQL Server 2000. I originally thought it would be as simple as putting a try catch statement around my code, like for oracle, and then specifying what errors I want to check for. However, it seems that its not that simple for SQL Server 2000.
What one article said is that I must declare a variable as an integer.
Then after every statement, i check the value of my variable. If the value has changed, then an error has occured otherwise nothing.
My questions is whether this is the best way to handle exceptions in my stored procedure?
Mike55.
Went looking for information on how to handle errors in SQL Server 2000. I originally thought it would be as simple as putting a try catch statement around my code, like for oracle, and then specifying what errors I want to check for. However, it seems that its not that simple for SQL Server 2000.
What one article said is that I must declare a variable as an integer.
Code:
Declare @err as int
Code:
Select @err = @@error
if @err <> 0
Return @err
My questions is whether this is the best way to handle exceptions in my stored procedure?
Mike55.