• Just correcting myself here :

    In my previous post I assume that you are creating a bitmap so I suggested you do something like this :

    Declare @BitMap as int

    set @BitMap = 0

    Select @BitMap = @BitMap | MyBit from

    (

    Select 1 as MyBit

    union all

    Select 2 as MyBit

    union all

    Select 4 as MyBit

    ) A

    Select @BitMap as BitMap

    /*but if all the attributes are unique you could also do it like this which may be a little less safe (have little experience with bitmaps)*/

    Select sum(MyBit) as BitMap from

    (

    Select 1 as MyBit

    union all

    Select 2 as MyBit

    union all

    Select 4 as MyBit

    ) A