Finding the next message

xp_findnextmsg returns the message identifier of the next message in the Adaptive Server inbox. Use the unread_only parameter to specify the messages for consideration:

You need the message identifier that is returned by xp_findnextmsg to pass to subsequent procedures that read and delete messages.