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 |
helixpoint
Constraint Violating Yak Guru
291 Posts |
Posted - 2013-05-30 : 12:58:58
|
Trying to figure out how to loop threw sqlselect name, email from tableOnethen loop.....EXEC msdb.dbo.sp_send_dbmail @profile_name = @name, @recipients = @email , @body = 'The stored procedure finished successfully.', @subject = 'Automated Success Message' ;DaveHelixpoint Web Developmenthttp://www.helixpoint.com |
|
MIK_2008
Master Smack Fu Yak Hacker
1054 Posts |
Posted - 2013-05-30 : 13:45:29
|
Why do you want to loop it? The body message shows that you want to send an email when ever a/the stored procedure is compelted/finsihed.. If so why not simply append this send email logic at the end of that SP? or somewhere in the code once the SP execution is successful ? by the way, example of the while loop is as following declare @x intset @x=0 while @x<>10begin print @xset @x=@x+1EndCheersMIK |
|
|
helixpoint
Constraint Violating Yak Guru
291 Posts |
Posted - 2013-05-30 : 14:26:25
|
The select bring back multiple recordsDaveHelixpoint Web Developmenthttp://www.helixpoint.com |
|
|
MIK_2008
Master Smack Fu Yak Hacker
1054 Posts |
Posted - 2013-05-30 : 14:38:35
|
quote: Originally posted by helixpoint The select bring back multiple recordsDaveHelixpoint Web Developmenthttp://www.helixpoint.com
what does it mean? what select bring back multiple records??CheersMIK |
|
|
djj55
Constraint Violating Yak Guru
352 Posts |
Posted - 2013-05-30 : 15:49:07
|
Is what you are trying to do, read a table of names then send an email to each name from that table? If so look at DECLARE CURSOR in BOL.djj |
|
|
|
|
|