Last post Jan 08, 2015 08:36 AM by Mongol648
Jan 07, 2015 08:23 AM|Mongol648|LINK
I am using SQL Server 2000. I need to create a DTS package that emails a link. The recipients will be a list but each address needs to get a seperate email, so a one to one.
I have started some code but I am just not sure where to go with it. Thoughts on how to do it?
Declare @MyRecipients nvarchar (255)
Declare @msg nvarchar (255)
declare @rph nvarchar (255)
Set @msg = ''
WHILE @MyRecipients IS NOT NULL
select @MyRecipients = (select DISTINCT ( [e-mail address] )
from tblemployee a where a.[employee name] in (
select distinct(rph_reviewed) from rph_tasks where taskdate >= getdate()-7 ))
select @rph = (select distinct(rph_reviewed)
from rph_tasks where taskdate >= getdate()-7 and )
IF @MyRecipients IS NOT NULL
set @msg = '<http://peerrevrph.aspx?rph_reviewed=' + rtrim(@rph) + '>'
@recipients = @MyRecipients,
@blind_copy_recipients = 'email@example.com',
@message = @msg,
@subject = 'Monthly Peer Review Data'
Jan 07, 2015 06:59 PM|AZMatt|LINK
Take a look at my stored procedure that uses a newer version of SQL and sp_send_dbmail, but the logic is the same...
Jan 08, 2015 08:36 AM|Mongol648|LINK
That helped! Thanks