You are currently offline, waiting for your internet to reconnect

FIX: The xp_readmail Extended Stored Procedure Overwrites Attachment That Already Exists

This article was previously published under Q331965
This article has been archived. It is offered "as is" and will no longer be updated.
BUG #: 362696(SHILOH_BUGS)
When you save an attachment by using the xp_readmail extended stored procedure in SQL Server 2000, if the attachment already exists in the temp folder, SQL Server overwrites the existing file.

With SQL Server 7.0, SQL Server renames the new file with a numeric suffix.

Service pack information

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

Hotfix information

The English version of this fix should have the following file attributes or later:
   Version       File name   --------------------------   8.00.695      Sqlmap70.dll				

NOTE: Because of file dependencies, the most recent hotfix or feature that contains the files may also contain additional files.

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.This problem was first corrected in Microsoft SQL Server 2000 Service Pack 4.
IMPORTANT: This article contains information about modifying the registry. Before you modify the registry, make sure to back it up and make sure that you understand how to restore the registry if a problem occurs. For information about how to back up, restore, and edit the registry, click the following article number to view the article in the Microsoft Knowledge Base:
256986 Description of the Microsoft Windows Registry

WARNING: If you use Registry Editor incorrectly, you may cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that you can solve problems that result from using Registry Editor incorrectly. Use Registry Editor at your own risk.

To control if SQL Mail overwrites existing attachment files after you apply this hotfix, you must first add the following registry key value:

OverwriteExistingAttachmentFiles DWORD
(assume default value of 1)

When you set OverwriteExistingAttachmentFiles equal to 0 (OverwriteExistingAttachmentFiles = 0) in the registry, attachment files cannot be overwritten. The OverwriteExistingAttachmentFiles key presents the file sequence as Sample.txt, Sample.txt1, Sample.txt2 and so on.

Here are some examples.

For a default instance the entry is:
For a named instance the entry is:

HKLM\Software\Microsoft\Microsoft SQL Server\InstanceName\MSSQLSERVER\OverwriteExistingAttachmentFiles
If the registry key value does not exist, SQL Mail will overwrite the existing attachment files.

For the new registry value to work, you must restart SQL Mail.

Article ID: 331965 - Last Review: 02/27/2014 21:15:44 - Revision: 4.3

Microsoft SQL Server 2000 Developer Edition, Microsoft SQL Server 2000 Standard Edition, Microsoft SQL Server 2000 Enterprise Edition, Microsoft SQL Server 2000 Personal Edition, Microsoft SQL Server 2000, Workgroup Edition, Microsoft SQL Server 2000 Desktop Engine (Windows), Microsoft SQL Server 2000 Enterprise Edition 64-bit

  • kbnosurvey kbarchive kbsqlserv2000presp4fix kbbug kbfix kbqfe KB331965