January 12, 2004 at 4:37 am
Hello,
My problem is a trigger defined on a table of an existing application. The trigger is not related to the application itself but to another one.
The trigger executes a stored procedure.
If something goes wrong in the stored procedure an error is returned and eventually returns it to the application that catches it and blocks execution of the transaction in progress...
My question is if it is possible to error handle the trigger itself so that it always returns success.
I tried RETURN 0 (but that isnt allowed apparently )
This is the trigger :
CREATE TRIGGER dbo.trig_sc2wl_startwo ON dbo.MP67T100
FOR UPDATE AS
DECLARE @new_status int
DECLARE @old_status int
DECLARE @old_ref varchar(8)
DECLARE @wcchar char(1)
DECLARE @return_status int
SELECT @new_status = SomeColumn FROM inserted
SELECT @old_status = SomeColumn FROM deleted
SELECT @old_ref = SomeColumn FROM deleted
select @wcchar = upper(left(SomeColumn, 1)) FROM inserted
-- I have tried using the following statement, but if the stored procedure fails
-- the application still catches the error ...
-- I've tried adding RETURN 0 at the end of the stored procedure ..
EXEC @return_status = dbo.sp_sc2wl_startwo
if @return_status <> 0
begin
return
end
Does anybody have any ideas about this one ?
Kind regards
Jean-Luc
January 12, 2004 at 8:18 pm
This page may help - http://www.algonet.se/~sommar/error-handling-II.html
------------
Ray Higdon MCSE, MCDBA, CCNA
January 14, 2004 at 9:24 am
hi!
see "Using @@ERROR" chapter in BOL. @@ERROR will help you checking execution result of your SQL statements in your stored procedure and react to error conditions occuring there.
best regards, chris.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply