Reputation: 21
I have the following that sends an email to recipients that I get from a table in my database. What Im trying to do is send this email every hour. How could I do that?
This is what I have right now?
DECLARE @recipient VARCHAR(4000)
USE data
SELECT @recipient = STUFF((SELECT ';' + email
FROM dbo.email
FOR XML PATH('')
), 1, 1, '')
EXEC msdb.dbo.sp_send_dbmail
@profile_name='SQL Server Alerts System',
@recipients = @recipient,
@subject='Test message',
@body='This is the body of the test message.
Congrates Database Mail Received By you Successfully.'
Upvotes: 2
Views: 1339
Reputation: 55
I know this post is long ago but just to add, you can actually do the following:
You can test it for yourself. Just wait patiently until the time for the job to run and see if you/recipient recipient receives any email
Upvotes: 0