|
-
May 18th, 2001, 09:38 AM
#1
Error handling in SQL Server
Hi
I have a stored procedure that will insert rows in several different tables. I have declared a variable @error to hold any errors returned. My question is, do I need to after every insert set the @error variable and trap for the error or can this all be done at the end of the stored procedure?
Thanks in advance
For example
Create Procedure InsertRows
As
Declare @error int
BEGIN
Insert into Table
Values ...
select @error = @@error
If (@error != 0)
Do something
Insert into Table
Values...
select @error = @@error
If (@error != 0)
Do something
END
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|