Home Forums SQL Server 2005 Development Try Catch alters behaviour of existing procedures RE: Try Catch alters behaviour of existing procedures

  • Again, take a deep breath. You're not thinking. Everyone is telling you the same thing and you're not listening. If a higher severity error is unhanded in spA and spA gets called from within a TRY, it will stop execution and go to the CATCH. This is supposed to be this way and any other way would be stupid

    it isn't stupid ... because any procedure written without a TRY block will already have @@error style resumptive error handling

    *or* will work incorrectly if called without a TRY in the call stack

    Look up TRY...CATCH in Books Online. What you've discovered is exactly its purpose.

    I have read it in detail ... it makes no mention of how this situation is handled - which is why I wrote tests to find out

    The end result is the same - there are two ways to call the same procedure and they result in different behaviour

    which means that a stored procedure isn't really a procedure (a reusable behaviour)

    but is acting more like an include file

    with "exec dbo.spBlah" equating to "#include <dbo.spBlah>" but with parameters

    Don't get me wrong - I am not arguing "against" TRY CATCH

    Just illustrating that there is subtle problem which nobody seems to realise except me

    If this is common knowledge - prove it with a link

    I have searched this forum and google and found no mention of the dual behaviour issue