<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Dbmail on Matt Thornton</title>
    <link>https://matt-thornton.net/tags/dbmail/</link>
    <description>Recent content in Dbmail on Matt Thornton</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <lastBuildDate>Mon, 12 Dec 2011 16:28:55 +0000</lastBuildDate><atom:link href="https://matt-thornton.net/tags/dbmail/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Error formatting query, probably invalid parameters [SQLSTATE 42000] (Error 22050)</title>
      <link>https://matt-thornton.net/tech/databases/error-formatting-query-probably-invalid-parameters-sqlstate-42000-error-22050/</link>
      <pubDate>Mon, 12 Dec 2011 16:28:55 +0000</pubDate>
      
      <guid>https://matt-thornton.net/tech/databases/error-formatting-query-probably-invalid-parameters-sqlstate-42000-error-22050/</guid>
      
        <description>&lt;p&gt;I just tripped over this problem, and despite a fair amount of Googlage, I didn&amp;rsquo;t find anything that directly resolved my issue. I was trying to use dbMail in SQL Server 2008 to send an email on a schedule which included the results of a query. Doing this should be fairly straightforward, by executing the sp_send_dbmail stored procedure, which is in MSDB:&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://matt-thornton.net/images/posts/Screen-shot-2011-12-12-at-16.27.36.png&#34;&gt;&lt;img loading=&#34;lazy&#34; src=&#34;https://matt-thornton.net/images/posts/Screen-shot-2011-12-12-at-16.27.36.png&#34; alt=&#34;&#34; title=&#34;Screen shot 2011-12-12 at 16.27.36&#34; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This query works fine in SSMS, but when run as a SQL Server Agent Job, it fails, with the error&lt;/p&gt;</description>
      
    </item>
    
  </channel>
</rss>