FIX: The xp_readmail and xp_findnextmsg Extended Stored Procedures Do Not Read Mail in Time Received Order

This article was previously published under Q331968
This article has been archived. It is offered "as is" and will no longer be updated.
BUG #: 362609 (SHILOH_BUGS)
With SQL Server 2000, the xp_readmail and the xp_findnextmsg extended stored procedures get the first mail in the Inbox, the last one received.

With SQL Server 7.0, xp_readmail and xp_findnextmsg get the mail in the order of time received.

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 the order SQL Mail reads MAPI information after you apply this hotfix, you must first add the following registry key value:

SortMailBoxByAscendingDate DWORD
(assume default value of 0)

After you set SortMailBoxByAscendingDate equal to 1 (SortMailBoxByAscendingDate = 1) in the registry, xp_findnextmsg and xp_readmail will display the MAPI information in the order of sender submitted date and time.

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\SortMailBoxByAscendingDate
If the registry key value does not exist, SQL Mail reads the last message received first.
After you add the new registry value, you must restart SQL Mail.

Article ID: 331968 - Last Review: 02/27/2014 21:15:44 - Revision: 5.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 KB331968