FIX: Return Code of xp_findnextmsg Changed to 1 Against an Empty Inbox (305573)



The information in this article applies to:

  • Microsoft SQL Server 2000 (all editions)

This article was previously published under Q305573
BUG #: 354989 (SHILOH_BUGS)

SYMPTOMS

A call of the xp_findnextmsg extended stored procedure returns 1 when the Inbox of the configured MAPI profile is empty. This is a regression in SQL Server 2000 from earlier versions, where xp_findnextmsg returned 0 under these circumstances. This regression makes it impossible to distinguish between a MAPI failure and an empty Inbox. This also affects the sp_processmail system stored procedure.

RESOLUTION

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 INF: How to Obtain the Latest SQL Server 2000 Service Pack

Hotfix

NOTE: The following hotfix was created prior to Microsoft SQL Server 2000 Service Pack 2.

The English version of this fix should have the following file attributes or later:
   Date         Time    Version   Size     File name     Platform
   --------------------------------------------------------------
   04-Aug-2001  12:19   8.00.427  172,600  Sqlmap70.dll  Intel
				
NOTE: Due to file dependencies, the most recent hotfix or feature that contains the above files may also contain additional files.

STATUS

Microsoft has confirmed this to be a problem in SQL Server 2000. This problem was first corrected in Microsoft SQL Server 2000 Service Pack 2.

MORE INFORMATION

To reproduce the problem, run the following SQL script:
exec master..xp_startmail '<your profile>'
go
DECLARE @status int, @message_id varchar(255)
EXEC @status = xp_findnextmsg @msg_id = @message_id OUTPUT
select Status=@status, Msg_id=@message_id
				
This returns a status of 0 on SQL Server 7.0, but a status of 1 on SQL Server 2000.

NOTE: If you installed version 8.00.427 of Sqlmap70.dll for other reasons, but your application code relies on the original behavior in SQL Server 2000 (xp_findnextmsg returns 1 against an empty Inbox), you can add the following value to the registry to revert to the original behavior of SQL Server 2000.
  • Name: FindNextMsgFailOnEmptyInbox
  • Type: DWORD
  • Value: 1
  • Location:

    • for a default instance of SQL Server 2000:

      HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\MSSQLServer

    • for a named instance:

      HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\<instance name>\MSSQLServer

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.

For additional information on other SQL Mail bugs fixed in the same hotfix, click the article number below to view the article in the Microsoft Knowledge Base:

300414 FIX: SQL Mail Operations May Lead to Failures and Memory Leaks


Modification Type:MajorLast Reviewed:10/9/2003
Keywords:kbbug kbfix KB305573