title: How can I get the full error message returned from a linked server query?
body: <p>I've created a procedure on a MySQL server which will always throw an error due to a primary key violation, this would be called from a Microsoft SQL Server over a linked server using this:</p>
  
  <p><code>EXEC ('CALL temp_test;') AT LINKSVR;</code></p>
  
  <p>When this is called i get this full message:</p>
  
  <pre><code>OLE DB provider "MSDASQL" for linked server "LINKSVR" returned message "[MySQL][ODBC 5.1 Driver][###########]Duplicate entry '1' for key 'PRIMARY'".
  Msg 7215, Level 17, State 1, Line 1
  Could not execute statement on remote server 'LINKSVR'.
  </code></pre>
  
  <p>Now what i want to do it put this in a <code>TRY...CATCH...</code>and output the error to a table, however when I use <code>ERROR_MESSAGE()</code> all I get us the last line</p>
  
  <p>is there a way to get the linked server message that was returned?</p>