March 22, 2011 at 8:44 am
Hi all,
I hope you can help me with my problem.
I try to manage errors that might happen during a backup process. Almost everything works fine except when 2 error messages are fired by SQLServer at the same time.
For example: A BACKUP LOG on a database with RECOVERY MODEL set to SIMPLE fires 2 different error messages, which is correct. The first one is ERROR_ID 4280 which gives informations about the recovery model. The second one is ERROR_ID 3013 which states that the backup terminated abnormally. That's all fine, except that @@error only traps the second message. The same when using the TRY ... CATCH blocks; only the error id 3013 is detected.
As SSMS traps both error messages when producing the error without error management, I was wondering if the same could be done using T-SQL.
Any help will be much appreciated.
🙂
March 22, 2011 at 12:26 pm
I cannot think of how you could know programmatically in T-SQL that the first one occurred...it's a popular topic right now though. Here is a related thread:
http://www.sqlservercentral.com/Forums/Topic1082102-338-1.aspx
As a side note if catching both were a hard requirement and you were able to called this from .NET you could catch both.
There are no special teachers of virtue, because virtue is taught by the whole community.
--Plato
March 23, 2011 at 2:19 am
Thanks for your answer opc.three!
it's only enhancement as the routine won't run often and crash even less.
Although too bad it is not possible to do it with T-SQL ...
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply