A client had a problem today with Database Mail. They use it to send alerts and attach query results to the email or format the body as HTML.
DESCRIPTION: Exception happened when running extended stored
procedure 'xp_sysmail_format_query' in the library 'xpstar90.dll'.
SQL Server is terminating process 382. Exception type: Win32 exception; Exception code: 0xc0000005.
The emails get sent when testing the Database Mail Profile and we double checked none of the permissions had changed.
Came across a forum thread where a few people had the same error, resolved it by simply recycling the SQL service. Seems a little drastic but I guess that depends on how important those emails are. The last post of that thread some guy says:
First off, this is not actually a SQL Server issue, but one for the OS. Install the ODBC fix from KB940046 (http://support.microsoft.com/kb/940046). There is a known issue with ODBC that affects 3 of the extended stored procedures in SQL Server 2005 (xp_delete_file, xp_enumerrorlogs, and xp_readerrorlog). If you apply the fix from this KB on your server(s), the error will no longer present itself.
Note: your ODBC drivers may currently have a higher build number than the fix has, apply it anyway, it is a QFE build and has not been (and will likely never be) folded into a GDR build.
Unfortunately we can’t replicate the issue on another server, so I got the client to try xp_delete_file but they worked. Now there in a bit of a pickle, they’ll recycle the service as they need to get it working and apply this patch. We won’t know for sure if this is the problem as it seems fairly intermittent for them and other folks. We’ll see if this helps but they will probably be off 2005 fairly soon so we might never know if this fixes the issue.