General information
Forum:
Microsoft SQL Server
Title:
Variables in Select Statements
I am trying to use a select statement using a variable for the database in the from clause.. ie
declare @MyVariable varchar(40)
select ColumnName
From @MyVariable
But it wont accept it.. I have tried putting the variable in [ ] but it still does the same thing.
The database name is in the varaible so it should work, and I take the variable out and put the database name in it works.
Thanks,
Jason
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