title: Failed to initialize sqlcmd library with error number -2147467259 how to resolve this?
body: <p>I've tried to find some information about this error but with no significant results. I try to send an email with Excel file as an attachment but I receive this error:</p>
  
  <blockquote>
    <p>Failed to initialize sqlcmd library with error number -2147467259</p>
  </blockquote>
  
  <p>Here's my code:</p>
  
  <pre><code>    EXEC msdb.dbo.sp_send_dbmail
      @profile_name= 'SQLProfile',
      @recipients='myemail@xxx.pl',
      @subject='HLR 1000 - CC Lista', 
      @body='Proteza - do przeksztalcenia z csv &gt; excel',
      @query =' print ''sep=;''; SELECT * from analizy.dbo.csv', 
      @attach_query_result_as_file = 1,
      @query_attachment_filename = 'CSV_Extract.csv',
      @query_result_header = 1,
      @query_result_separator = ';',
      @query_no_truncate = 1
  </code></pre>