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 |
|
jose1lm
Yak Posting Veteran
70 Posts |
Posted - 2004-09-28 : 12:48:20
|
I'm not sure why I'm getting an error in this code:***************************Declare @users varchar(8000)SELECT @users = COALESCE(@users + '; ', '') + 'exec sp_isowi_cdontsmail_notify '''+ CAST(pin AS varchar(15)) + '''' + ',''' + wi + '''' + ',''' + CAST(trainers AS varchar(15)) + ''''FROM dbo.iso_tmpmail2SELECT @usersexec @users ***************************The error I get:(1 row(s) affected)Server: Msg 203, Level 16, State 2, Line 8The name 'exec sp_isowi_cdontsmail_notify '170','QP4-1','105'; exec sp_isowi_cdontsmail_notify '37','WI6-3-530','37'; exec sp_isowi_cdontsmail_notify '170','WI4-2-002','105'; exec sp_isowi_cdontsmail_notify '170','WI4-2-008','105'' is not a valid identifier.However, if I construct the execution string manually, it works fine:exec sp_isowi_cdontsmail_notify '170','QP4-1','105'; exec sp_isowi_cdontsmail_notify '170','QP5-1','105'. . . etcThanks, JLM |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2004-09-28 : 12:56:33
|
| i think the problem is that you are "exec"ing an EXEC. |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2004-09-28 : 13:19:40
|
do this:exec (@users)Go with the flow & have fun! Else fight the flow |
 |
|
|
jose1lm
Yak Posting Veteran
70 Posts |
Posted - 2004-09-28 : 13:46:55
|
| That worked, spirit1.Thanks again! |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2004-09-28 : 13:49:55
|
i know . should have warned you about that before...Go with the flow & have fun! Else fight the flow |
 |
|
|
|
|
|
|
|