You could also use the bitwise AND operatorWHERE b.fld1 & b.fld2 & b.fld11 ... = 1I don't like computed columns but you could do:Alter Table tbx add fld19 cast (b.fld1 & b.fld2 & b.fld3 ... as bit)
fld19 would be a bit column that equaled 1 when all others were 1, 0 otherwise. You could make it varchar too if you wanted.I don't like triggers that I can avoid either, but sometimes you have to pick the lesser of two evils. Do you want updates to be fast or queries?You could also: create viewv_mytable with schemabindingas select ID, fld1, fld2, fld3,... cast (b.fld1 & b.fld2 & b.fld3 ... as bit) fld19
Then index itcreate unique clustered index v_flds_id_idx on v_mytable (Id)then you could create an index on fld19create index v_flds_19_idx on v_mytable (fld19)
--KenYour Kung-Fu is not strong. -- 'The Core'