General information
Forum:
Microsoft SQL Server
Title:
Variable Substitution
I want to write a select statement where I can use a variable to store the table name, then use that variable in my select statement. For example:
Instead of:
Select * from Mytable
I want to:
Set @SomeTableName = 'Mytable'
Select * from @SomeTableName
but, I can't get it to work. Can you tell me how I should approach this problem.
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only