Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xp_findnextmsg in a loop

Status
Not open for further replies.

mici

Programmer
Jun 2, 2003
36
IL
how do u use xp_findnextmsg in a loop?
I would like to get some messages in a loop , but i dont want the result set of all messages because i need to control the output, insert it to db etc'

i have tried this: (but it get stuck)

declare
@msg_id varchar(255),
@message varchar(255),
@status int

while (1=1)
begin

EXEC @status =xp_findnextmsg
@msg_id = @msg_id output, @unread_only = true


IF @status <> 0 BREAK
select @msg_id

end
 
In master there is a sample procedure that you can use for reference. I believe that it is called sp_readmail.

It contains the code to read the mail in a loop.

Denny

--Anything is possible. All it takes is a little research. (Me)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top