Quote:
Originally Posted by Martijnvs
Does select col1,col2 from ' + @tablename + ' where mycondition return any data?
|
Thanks for the reply.
Yes, if I give a value to @tablename I get result.
It's the same for
exec ('insert desttable
select col1,col2 from ' + @tablename + ' where mycondition ')
when I fixed in advance the value of my variable, means:
select @tablename = 'myvalue'
exec ('insert desttable
select col1,col2 from ' + @tablename + ' where mycondition ')
I got data copy into "desttable". but when I put this command inside a loop command, the copy is not working.