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
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