Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
kdeutsch
Yak Posting Veteran
83 Posts |
Posted - 2013-01-24 : 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 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-01-25 : 00:59:47
|
it will just send a single mail under current logic. As you've not written iterative logic to fetch next records from table.The first select just takes a random set of values from table to variables.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|