You can use dynamic SQL and a while loop with sys.columns to run through your table, but this is kludgey and I wouldn't reccomend it, plus you'll experience horrible performance issues, always try to hard code your where clauses as this is part and parcel of the overall performance of your query.
SELECT *
FROM TABLE
WHERE COLUMN1='RED'
OR COLUMN2='RED'
OR COLUMN3='RED'
ETC...
This really is your best bet I'm afraid.
No comments:
Post a Comment