How to log errors from MySQL-ODBC-driver in Microsoft SQL Server

432 views Asked by At

I want to log errors from my odbc-connection. For example it should be possible to see a simple syntax error. This works great:

BEGIN TRY

    Declare @t as money
    set @t = 1/0

END TRY
BEGIN CATCH

    Print ERROR_MESSAGE();

END CATCH

The query returns the error message. Works great.

This also works, because there seems to be a red message?

BEGIN TRY

    EXEC('Selllect 1/0 as Column1 ') AT VERBINDUNGSSERVERNAME

END TRY
BEGIN CATCH

    Print ERROR_MESSAGE();

END CATCH

Screenshot:

enter image description here

But unfortunately not every ODBC error was logged. But I want to log all of these odbc errors. The next example is not logged by the try-catch block:

enter image description here

I'm using a lot of query stacks and it would be helpful to get a valid error log :-) Thank you!

0

There are 0 answers