title: using msdb.dbo.sp_send_dbmail with @query parameter error in trigger
body: <p>I've an after DELETE TRIGGER that wants to send an email.</p>
  
  <p>All is working fine except when I try to add the @query parameter to the msdb.dbo.sp_send_dbmail.</p>
  
  <p>My scope is like this:</p>
  
  <pre><code>EXEC msdb.dbo.sp_send_dbmail
      @profile_name = 'myprfilename',
      @recipients = 'listofrecipients',
      @subject = 'test trigger email',
      @query = 'select * from DELETED'
  </code></pre>
  
  <p>and the error message is:</p>
  
  <blockquote>
    <p>Msg 22050, Level 16, State 1, Line 3 Failed to initialize sqlcmd
    library with error number -2147467259.</p>
  </blockquote>
  
  <p>If I remove the @query parameter, the email is sent correcly.
  Any idea of how resolve my issue?</p>
  
  <p>The production server is SQL 64bit version 12.0.2000.8</p>