Lynne
May 18th, 2001, 09:38 AM
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
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