1

Possible Duplicate:
Dynamic SQL (passing table name as parameter)
Sql - tablename as variable

Is it possible to use a @param inside the stored procedure as a dynamic table name like this?

SELECT * FROM @tablename 

Because i'm getting an error like this:

Msg 1087, Level 16, State 1,

Must declare the table variable "@tablename".

@tablename is defined as a param, why am i seeing this?

Community
  • 1
  • 1
Control Freak
  • 12,965
  • 30
  • 94
  • 145

0 Answers0