FIX: xp_findnextmsg Does Not Return a Value for @msg_id Parameter on Output

Article translations Article translations
Article ID: 281238 - View products that this article applies to.
This article was previously published under Q281238
BUG #: 351342 (SHILOH_BUGS)
Expand all | Collapse all


When the xp_findnextmsg stored procedure is executed with the @msg_id parameter and the OUTPUT keyword, the parameter does not correctly contain the message ID on output.


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


Microsoft has confirmed that this is a problem in SQL Server 2000. This problem was first corrected in SQL Server 2000 Service Pack 1.


The xp_findnextmsg stored procedure is used to retrieve the ID for the next e-mail message in the SQL Mail inbox. Prior to SQL Server 2000 SP1, the @msg_id input and output parameter does not correctly contain the message ID on output.

For example, the following statements return no data:
DECLARE @status int, @message_id varchar(255)
EXEC @status = xp_findnextmsg @msg_id = @message_id OUTPUT
SELECT @message_id     --Returns no data.  
If the variable is set to a value prior to executing the stored procedure, that value is unchanged afterwards:
DECLARE @status int, @message_id varchar(255)
SELECT @message_id = '0x00000000DC66A212B5A2D31180E200805F9F5E780100CBC49A5D9F4C90409F87850197457A2000000139A8560000'
EXEC @status = xp_findnextmsg @msg_id = @message_id OUTPUT
SELECT @message_id     --Returns '0x00000000DC66A212B5A2D31180E200805F9F5E780100CBC49A5D9F4C90409F87850197457A2000000139A8560000'  
Note that xp_findnextmsg is also called from within the sp_processmail system stored procedure.


Article ID: 281238 - Last Review: October 17, 2003 - Revision: 3.2
  • Microsoft SQL Server 2000 Standard Edition
kbbug kbfix kbsqlserv2000sp1fix KB281238

Give Feedback


Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from