declare @hMessage varchar(255)
exec master..xp_findnextmsg @msg_id=@hMessage OUT
while @hMessage is not null
begin
exec master..xp_deletemail @hMessage
exec master..xp_findnextmsg @msg_id=@hMessage OUT
end
----------------------------------------------------
This code delete only one message (the first), why?
exec master..xp_findnextmsg @msg_id=@hMessage OUT
while @hMessage is not null
begin
exec master..xp_deletemail @hMessage
exec master..xp_findnextmsg @msg_id=@hMessage OUT
end
----------------------------------------------------
This code delete only one message (the first), why?