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



The information in this article applies to:

  • 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 Enterprise Evaluation Edition
  • Microsoft SQL Server 2000 Workgroup Edition
  • Microsoft SQL Server 2000 Desktop Engine (MSDE)
  • Microsoft SQL Server 2000 Developer Edition 64 bit
  • Microsoft SQL Server 2000 Enterprise Edition 64-bit

This article was previously published under Q331965
BUG #: 362696(SHILOH_BUGS)

SYMPTOMS

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.

RESOLUTION

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.


STATUS

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.

MORE INFORMATION

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:

HKLM\Software\Microsoft\MSSQLSERVER\MSSQLSERVER\OverwriteExistingAttachmentFiles

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.

Modification Type:MajorLast Reviewed:2/10/2005
Keywords:kbSQLServ2000preSP4fix kbbug kbfix kbQFE KB331965