MS SQL 2000 How to refer to a column name in query?
Posted: Wed Oct 15, 2008 3:23 pm
Hi,
I have a table [A] with a bunch of columns and another table with a list of those columns. Table not only lists the names of the columns but categorizes them.
I need to select from [A] where the column name exists in when the category = 'x'.
I know the layout is not ideal but a program sets up the table structures. Anybody know how I can reference the column names in the query?
I'm working with something like:
Select *
from [A]
where [A].* in
(Select field_name from where category = 'potatoes')
I have a table [A] with a bunch of columns and another table with a list of those columns. Table not only lists the names of the columns but categorizes them.
I need to select from [A] where the column name exists in when the category = 'x'.
I know the layout is not ideal but a program sets up the table structures. Anybody know how I can reference the column names in the query?
I'm working with something like:
Select *
from [A]
where [A].* in
(Select field_name from where category = 'potatoes')