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 |
|
brendalisalowe
Constraint Violating Yak Guru
269 Posts |
Posted - 2004-11-10 : 14:19:47
|
| I want to be able to pull data from a table and put that into the subject line of an email. Can anyone tell me why this won't work?declare @counter intdeclare @length intdeclare @subjname char set @length = (select count(CaseNumber) From tblEmail) set @subjname = (select CaseNumber from tblEmail) set @counter = 0 while @counter < @length begin exec master..xp_sendmail @recipients='collections@capitaltracer.com', @subject= @subjname, @message = 'Send out a letter!' set @counter = @counter + 1 endand when I do this, it only puts a 3 in the subject line:declare @counter intdeclare @length intdeclare @subjname varchar set @length = (select count(CaseNumber) From tblEmail) set @subjname = '321-654987' set @counter = 0 while @counter < @length begin exec master..xp_sendmail @recipients='collections@capitaltracer.com', @subject= @subjname, @message = 'Send out a letter!' set @counter = @counter + 1 endThanks!BrendaIf it weren't for you guys, where would I be? |
|
|
AndyB13
Aged Yak Warrior
583 Posts |
Posted - 2004-11-11 : 02:20:28
|
| Brenda Will it send mail at all??Or are you having trouble creating a "mass mail sproc".Do an article search on here for email for different examples[url]http://www.sqlteam.com/searchresults.asp?SearchTerms=email&SUBMITs1=Search[/url]With regards to your other question you have not specified a data length, so because it isnt specified SQL uses the default (1)DECLARE @subjname varchar(100)SET @subjname = '321-654987'SELECT @subjnameAndy |
 |
|
|
|
|
|