Microsoft KB Archive/296098

= FIX: xp_sendmail Fails with the @attach_results Parameter on SQL Server 2000 Personal Edition =

Article ID: 296098

Article Last Modified on 11/2/2007

-

APPLIES TO

 Microsoft SQL Server 2000 Personal Edition, when used with:  Microsoft Windows 98 Standard Edition

 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

<div class="status_section">

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.

<div class="moreinformation_section">

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.

Additional query words: Attachment, Mail

Keywords: kbbug kbfix kbsqlserv2000sp1fix KB296098

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.