table names as paramaters?

  • Thread starter Thread starter Brian Henry
  • Start date Start date
B

Brian Henry

Can you use a paramater for a table name like this

"SELECT * from @tablename;" ?

or would i just have to concatinate the table name in as a normal string
variable? (im trying to make a paramater for an object to be a table name of
where to read data from...
 
No, not really. The SQL Server compiler will not want to create a query plan
that has to substitute a major component like the table name. You can create
a concatenated query or use the "EXEC SQL" where you construct the SQL on
the fly in the SP.

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Back
Top