tsql - How can I get the full error message returned from a linked server query? -
i've created procedure on mysql server throw error due primary key violation, called microsoft sql server on linked server using this:
exec ('call temp_test;') @ linksvr;
when called full message:
ole db provider "msdasql" linked server "linksvr" returned message "[mysql][odbc 5.1 driver][###########]duplicate entry '1' key 'primary'". msg 7215, level 17, state 1, line 1 not execute statement on remote server 'linksvr'.
now want put in try...catch...
and output error table, when use error_message()
last line
is there way linked server message returned?
ok, got work around, doesn't output table i'm sure can log somewhere
effectively this
begin try exec ('call sp_test;') @ linksvr; end try begin catch raiserror(n'error called on linked server',16,1) end catch
raiserror
output custom error , message returned linked server, message link server still can't stored in table sql server agent job activity monitor job still fail @ step occurs , in step details data outputted
Comments
Post a Comment