Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 looking for Field name from table on select criteria

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-09-19 : 07:41:20
Hari writes "Sub:- looking for Field name from table on select criteria

dear friends


I have an table [assosories] which have 100 fields. initial 10 fields have some date, varchar, int types rest 90 are bool type.

for a single row I need to know the field name which have true vaules in rest 90 fields

I need to insert this field name into another table as a row.

Thanks
HARI"

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-09-19 : 08:06:46
Should ALL other 90 fields be TRUE? Or is ANY other 90 fields set to TRUE?


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-09-19 : 08:10:08
Is this what you want?

Select SomeCol
From Tbl
Where BoolCol1 = 1
and BoolCol2 = 1
and BoolCol3 = 1
...


If you want to avoid typing column names, query them from Information_Schema.Columns.

Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page
   

- Advertisement -