Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How To Do A Select * From @TableName ?
Message
From
11/09/2006 10:51:22
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
Other
Title:
How To Do A Select * From @TableName ?
Environment versions
SQL Server:
SQL Server 2000
Miscellaneous
Thread ID:
01152754
Message ID:
01152754
Views:
63
If I do this...

declare @TableName as varchar(50)
set @TableName = 'MyTable'
select * from @TableName

I got the follwing error...
Must declare the variable '@TableName'.

Why my variable is not recognized as table name?
Something wrong? How can I use a table name in variable?
Thank you!
Marc Levesque
La Prairie, Quebec (CANADA)
marc.levesque@videotron.ca
Next
Reply
Map
View

Click here to load this message in the networking platform