April 1, 2009 at 11:11 am
How to achive this in T-SQL sp?
I want to send same email message but different email ids at different timings.
For example
send email to address - xxx at xxxxxx.com from 10 AM to 10 PM
and
send email to address - zzz at zzzzzz.com from 10.01 PM to 9.59 AM
EXEC master.dbo.xp_sendmail
@recipients = 'xyz at xxxxxx.com',
@message = 'for test'
April 1, 2009 at 11:25 am
You would need to use a change in code before the xp_sendmail
if datepart( hh, getdate()) > 22
set @to = 'zz@zz.com'
else
set @to = 'xx@xx.com'
exec xp_sendmail @recipients = @to
April 1, 2009 at 2:12 pm
You can even schedule Jobs using Agent Service.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply