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 |
techdawg270
Starting Member
4 Posts |
Posted - 2010-08-26 : 10:22:07
|
I can't figure out what I am doing wrong here. Any insight would be greatly appreciated. Here is the code:exec( 'insert into #tempClientsToRemove (client_uid)' ' (select client_id from ' + @tableNames + ' where client_id in (select uid from #tempClientsToDelete)' ' and date_updated > '2005-12-31'' ' and date_added > '2005-12-31'' ) The error message reads, "Incorrect syntax near ' (select client_id from '." |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2010-08-26 : 11:00:59
|
Remove the left paranthesis before the select word.declare @sql varchar(max)set @sql = 'insert into #tempClientsToRemove (client_uid) select client_id from ' + @tableNames + ' where client_id in (select uid from #tempClientsToDelete) and date_updated > ''2005-12-31'' and date_added > ''2005-12-31''exec( @sql ) N 56°04'39.26"E 12°55'05.63" |
 |
|
|
|
|