ERROR_MESSAGE() returns different message then the one shown in the message tab in MSQL Management Studio

  • Hello guys

    I'm hitting a wall here, i have a certain procedure1 call a procedure2 on a linked server. It works well. But when i tried error handling of procedure1 (which calls a write_errorlog, something in the lines of error_message()) the error_message() message in the log is completely different from the one that i get in the Management studio

    Question is how do i get the real message?

    Message returned by Mananagement studio:

    OLE DB provider "DB2OLEDB" for linked server "db2conn" returned message "A SQL error has occurred. Please consult the documentation for your specific DB2 version for a description of the associated Native Error and SQL State. SQLSTATE: 22012, SQLCODE: -801".

    Message in my log

    Could not execute statement on remote server 'db2conn'.

    Note that the exception is made with intention to check the error handling (its div by zero error)

  • I may not have been comprehensive enough.

    How do i get OLE DB provider error message and not the SQL server message (read above)

  • Without knowing your current code (where did you place the TRY CATCH block?) it's unlikely we can help to solve the issue. So, please post the relevant code snippet.



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • the code looks like this

    trigger

    begin try

    transaction

    end try

    begin catch etc...

    But i've just fixed (2 days for such an easy sollution hehe) this by making the DB2 SP return another out which is a DIAGNOSTICS message

    Thanks for the help anyway , i hope to return the favor soon

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply