March 20, 2006 at 1:19 am
Hi
I need to update my table based on many condition. For this I have created many update SP's, each one updating the table for one condition. I have a table configured for these SPs, in which the order of execution and the SP name present.
Now I have created a Master SP that will fetch the SP name from this configuration table and execute them one by one using cursor. If the update is successful, the update SP's will return '0' else the error code. If the Error code is returned, then it has to be updated into an Error table and rollback the transaction.
Now I have 2 issues
1. While there is an error, its returning the Error code and the Error message. I want to suppress the Error message, I need only the Error code. How to do this ?
2. I don't want to log all these transactions. How to make my query so that i does not log this operation ?
Thanks
S A T ...
Sathish's Blog
March 20, 2006 at 8:49 am
1)
There are different kinds of errors, with different behaviour regarding to what you can and can't catch within a stored procedure. Do you have an example of an error (with text) showing what you want to do..?
2)
Do you mean 'not log' as in 'not write to the transaction log'?
There is no way to 'turn off' writing to the tran log.
/Kenneth
March 20, 2006 at 6:24 pm
like Ken said, if the error is level 16 or above, (foreign key constraint,unique constraint, primary key for example) it cannot be capture via TSQL.
use a different style of logic to work around; ie test for the offending condition before doing any work
if not exists(select childkey from sometable where otherkey in(select other key from master table) )
begin
delete from sometable where otherkey in(select other key from master table) )
end
Lowell
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply