FIX: xp_sendmail Fails with the @attach_results Parameter on SQL Server 2000 Personal Edition (296098)



The information in this article applies to:

  • Microsoft SQL Server 2000 Personal Edition, when used with:
    • the operating system: Microsoft Windows 98
    • the operating system: Microsoft Windows Millennium Edition

This article was previously published under Q296098
BUG #: 353394 (SHILOH_BUGS)

SYMPTOMS

The xp_sendmail extended stored procedure may raise the following error if you try to send query results by e-mail using the @attach_results parameter from SQL Server 2000 Personal Edition:
Server: Msg 18024, Level 16, State 1, Line 0
xp_sendmail: failed with operating system error 87
This problem does not occur when SQL Server 2000 Personal Edition is installed on Microsoft Windows 2000 Professional.

RESOLUTION

To resolve this problem, obtain the latest service pack for SQL Server 2000. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

290211 INF: How to Obtain the Latest SQL Server 2000 Service Pack

STATUS

Microsoft has confirmed that this is a problem in SQL Server 2000. This problem was first corrected in SQL Server 2000 Service Pack 1.

MORE INFORMATION

The @attach_results parameter is an optional parameter for xp_sendmail which specifies that the result set of a valid query should be sent in e-mail as an attached file instead of being appended to the message. The default value for @attach_results is FALSE, which means that the query result set is appended to the message. If the @attachments optional parameter for xp_sendmail is not NULL and @attach_results is TRUE, the first file name in @attachments is used as the file name for the query results. If @attachments is NULL, a file name is generated with a .txt extension.

Steps to Reproduce Behavior

Execute the following statements in Query Analyzer after replacing <valid_email_address> with a valid email address:
DECLARE @r AS int
EXEC @r = master..xp_sendmail	@recipients = '<valid_email_address>',
				@message = 'Message text',
				@query = 'SELECT * FROM titles',
				@subject = 'SQL Mail test to attach query results',
				@attach_results = 'TRUE',
				@dbuse = 'pubs'
				
The correct results on executing the code should be as follows:
Mail sent.

Modification Type:MinorLast Reviewed:9/27/2004
Keywords:kbBug kbfix kbSQLServ2000sp1fix KB296098