Re: try catch ok, what about finally?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance




"JCollum" <jcollum@xxxxxxxxx> wrote in message
news:1163039479.981830.318970@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Read the TRY CATCH docs closely and you'll find that some errors are at
a level that's low enough that the catch block will ignore them. I
beliece the cutoff is 11?

Or maybe 10.

Anything that is "high" enough to trigger the
catch will also roll back the transaction and anything that it
triggered. Try your code with a RAISERROR with a level of 11 and I'm
betting that you're log won't get written out.

I'll see your 11 and RAISE you 4. It's obvious you didn't bother copying
and pasting the code, so here's another simpler example for you to pick
apart without actually "testing" per se:

CREATE TABLE #log (err NVARCHAR(2000) NOT NULL);

BEGIN TRY
RAISERROR('Error', 15, 127);
END TRY
BEGIN CATCH
INSERT INTO #log (err)
VALUES (ERROR_MESSAGE());
END CATCH

SELECT * FROM #log;

DROP TABLE #log;

What I"m wondering is if there's any way to do something in this
situation that won't get rolled back.

....


.



Relevant Pages

  • Re: Amazon loses plot
    ... err, yes. ... I'm going to roll out the "under stress" excuse again. ...
    (uk.rec.motorcycles)
  • Re: Weird Issue
    ... Err, yea, Sorry for all the errors, I'm rather new to C.:roll: ... Prev by Date: ...
    (comp.lang.c)
  • Re: JonesForth queries
    ... Andrew Haley wrote: ... Err, ROLL is to be avoided like the plague. ...
    (comp.lang.forth)