Showing posts with label isselect. Show all posts
Showing posts with label isselect. Show all posts

Sunday, February 19, 2012

Database Query

Is it possible to return the column names from the database using a SQL query,
what i need to do is
SELECT * FROM FEATURES WHERE 'VALUE' = 'YES'

i have a table which has a list of features and if they are selected i store the value yes, otherwise no . i want to be able to display a list of the features from the tables which have the value yes ! is this possible?yes xcept you dont need quotes around the column name..


SELECT * FROM FEATURES WHERE VALUE = 'YES'

hth|||Cheers but I worded the problem badly, VALUE isnt the name of the column, their are a number of different columns, each with different names, and i only want to display the column name if the value is yes ! any idea's?|||you wound then need to use CASE statement...check BOL for xact syntax but its something like


...
CASE
WHEN
colname='yes' then colname
ELSE NULL

hth|||what is BOL?|||BOL = Books Online

It is SQL Server's documentation.