title: How can I output the print message from a SQL Server?(DB-Link Error Message)
body: <p>As below the code or screenshot, now I have a Link-Server to Oracle DB, and try to execute the error.</p>
  <p>But the error message not result Oracle original error code, this is translated by MS SQL.</p>
  <p>I need take Oracle original error code(Ex: ORA-01400), it's shown on the &quot;Message Tab&quot;.</p>
  <p>How can I extract it?</p>
  <p>Thanks!</p>
  <p><a href="https://i.stack.imgur.com/Tocq6.png" rel="nofollow noreferrer">Demo Code:</a></p>
  <pre><code>begin try
      EXEC sp_executesql N'EXEC EIP..SP_F_TEST_0602 ''A'' ';
  end try
  begin catch
    print 'A'
    SELECT ERROR_NUMBER(), ERROR_SEVERITY(), ERROR_STATE(), ERROR_PROCEDURE(), ERROR_LINE(), ERROR_MESSAGE()
  end catch
  </code></pre>
  <p><a href="https://i.stack.imgur.com/3tOcx.png" rel="nofollow noreferrer">Message Tab:</a></p>
  <blockquote>
  <p>OLE DB provider &quot;OraOLEDB.Oracle&quot; for linked server &quot;TPE15_WHPR&quot;
  returned message &quot;ORA-01400&quot;.</p>
  </blockquote>