var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Stored Procedure Error Handling
I have been writing a back-end app 99% in SQL 7 stored procedures. It is necessary to document what is going through the system in an application log table I created.
I have been trapping SQL errors to determine if I write successful or error messages.
SELECT @v_sql_error = @@ERROR, @v_row_count = @@ROWCOUNT
IF @v_sql_error <> 0
SET @v_return_code = 999
The issue is I have some programs that use Bulk Insert statements. Those bomb the procedure instead of setting the @@ERROR. I have tried Adding BEGIN..END to further trap it with no success.
I could Insert a "Failed" message first and update it with success if the BULK insert works. My concern is that the processing may not continue in the calling stored procedure.
Any help is appreciated,
Re: Stored Procedure Error Handling
I ended up using xp_command to call the stored proc with upload with isql. It is a hack, but the application works very well and traps all the errors without uncontrolled exceptions.