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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2006-11-09 : 08:19:16
|
| Doug writes "Hi,I am having trouble inserting 2 fields in a row using a stored procedure.This works fine:Exec ('Insert Into NumbersPull (Number)'+ @SQL)but when I try to insert another value into field 2 it errors out:I try this:Exec ('Insert Into NumbersPull (Number,resultID) Select ('+ @SQL+ '),' + @resultID')and get this error:ERROR: Line 2: Incorrect syntax near ')'.Thanks,Doug" |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-11-09 : 08:30:32
|
[code]exec ('Insert Into NumbersPull (Number,resultID) Select ' + @SQL + ',' + @resultID [/code] KH |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-11-09 : 11:16:41
|
| Why are you using Dynamic SQL?Insert Into NumbersPull (Number,resultID) Select @SQL,@resultIDMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|