|
kdeutsch
Yak Posting Veteran
USA
75 Posts |
Posted - 01/24/2013 : 11:28:46
|
Trying to lopp through my temp table to send out emails to indivduals, does note seem to work. what am i doing wrong.
set rowcount 0
Select @Name = Name, @Email = Email, @Idate = IssueDt, @Rdate = TurnIN, @Days = DaysOver from #TempEmail; While @@rowcount <> 0 BEGIN --- do send the email here ... Set @Subject = 'Temporary Issue is Overdue' Set @Body = 'The following item of equipment temporarily issued on {' + @Idate + '}.' + ' ' + 'The equipment was due on {' + @Rdate + '} and is overdue by {' + @Days + '} Days.' + Char(13) + Char(10) + 'Please return the equipment or make arrangements to keep equipment longer.' + Char(13) + Char(10) + 'SN = ' EXEC msdb.dbo.sp_send_dbmail @recipients = @To, @body = @Body, @subject = @Subject, @profile_name = 'ACN' END set rowCount = 1 |
|