SyntaxFix
Write A Post
Hire A Developer
Questions
Take a look at OPENROWSET, and do something like:
OPENROWSET
SELECT * INTO #TEMPTABLE FROM OPENROWSET('SQLNCLI' , 'Server=(local)\SQL2008;Trusted_Connection=yes;', 'SELECT * FROM ' + @tableName)