Results 1 to 2 of 2

Thread: PLEASE HELP!!! multiple error messages in SS2K5

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2007
    Posts
    58

    PLEASE HELP!!! multiple error messages in SS2K5

    I have a SS2K5 stored procedure that executes 2 others stored procedures
    sp_zero1 and sp_zero2
    sp_zero1 and sp_zero2 do the same thing ... raises an Divide by zero error
    I need to (print / select into a database) both error messages using just one
    try catch block instead of 2 blocks like in the next example:


    -- THIS IS THE WORKING CODE THAT I DONT WANT
    BEGIN TRY
    exec sp_zero1
    END TRY
    BEGIN CATCH
    PRINT ERROR_MESSAGE()
    PRINT ERROR_PROCEDURE()
    END CATCH
    BEGIN TRY
    exec sp_zero2
    END TRY
    BEGIN CATCH
    print ERROR_MESSAGE()
    print ERROR_PROCEDURE()
    END CATCH



    if I try the next code

    --THIS IS THE NON WORKING CODE
    BEGIN TRY
    exec sp_zero1
    exec sp_zero2
    END TRY
    BEGIN CATCH
    print ERROR_MESSAGE()
    print ERROR_PROCEDURE()
    END CATCH

    only the first error message is printed and the execution is stopped

    This is a generic example ... in reality I have a stored procedure that executes tens and hundreds of other stored procedures ... so thats the reason I need just one block of try catch instead of hundreds of blocks

    thank you

  2. #2

    Thread Starter
    Member
    Join Date
    Nov 2007
    Posts
    58

    Re: PLEASE HELP!!! multiple error messages in SS2K5

    I dont need exclusively try catch blocks ... I just want to store into a table the error messages no matter how are inserted there

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width