April 9, 2003 at 4:03 pm
I am having an issue with the results I send through email using cdosys. Below is my code:
CREATE PROCEDURE CURSOR_SEND_RS_EMAIL
AS
DECLARE @RecID varchar(4), @Date (Varchar 30) , @Msg varchar(5000), @rs varchar(8000)
DECLARE Email CURSOR FOR
Select RecID ,Date, Message
from messages
where datediff(hh, Date, getdate())< 6
order by Date
OPEN Email
FETCH NEXT FROM Email
INTO @RecID, @Date, @MSg
WHILE @@FETCH_STATUS = 0
BEGIN
Set @rs = "Messages in the last 6 hours " + RecId + ": ", + @Date + ": " + @Msg
--PRINT @rs
execute SEND_RS_EMAIL 'me@fun.com', 'you@fun.com', '6 hour MSG', @rs
FETCH NEXT FROM Email
INTO @RecID, @Date, @MSg
END
CLOSE TRs
DEALLOCATE TRs
GO
The problem I am having is the order I need the results sent -- Requirement is by date. When I run the procedure in query analyzer and PRINT the results, they are in order. When it is emailed through the above procedure, the emails received are not ordered by date? Any thought on this would be greatly appreciated.
Chris
April 10, 2003 at 6:04 am
The Stored procedure seems Ok to me.
This could be an issue within mail server (not able to distinguish between the mails that have been sent within short very duration of time)
Just a hint. Try to put a slight delay between sending mails and see whether this solves the problem
waitfor delay "00:00:01"
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply