Link to home
Start Free TrialLog in
Avatar of ironpen45
ironpen45

asked on

create a new table with a variable name

i keep getting "Msg 102, Level 15, State 1, Line 26 Incorrect syntax near '@newtbl'."

for

SELECT * INTO @newtbl FROM TMP8.dbo.tblQuery8

please help. thanks!
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

you have to use dynamic SQL.

check "Dynamic SQL in a stored procedure" from http://www.sqlteam.com/article/introduction-to-dynamic-sql-part-1
Avatar of manishkungwani
manishkungwani

The query is not correct, can you state what you want to do, so that I can suggest the right query for you.
Give me more into what you would like to do with this query and i'll just give you the code
ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ironpen45

ASKER

thanks!