Sorry for a delay.... well deserved vacations.
For now I will go with solution similar to attached code snippet. Query might be a bit different as question above, but idea works (code snippet reflects my real case a bit more). Pivot list is not dynamic, but query statement will be dynamicaly created as a workaround.
I will optimize it when I get around it.
Thanks!
Main Topics
Browse All Topics





by: momi_sabagPosted on 2009-07-28 at 21:08:53ID: 24967110
hi
i don't believe you will be able to do what you want for 2 reasons:
1) the pivot statement has to have a fixed list of values, thus it can't be static, you will have to dynamically build it using the list of possible values you wish to see
2) since bitwise fields are not discrete (that is, they have a range - the attribute 1 will exist for all odd numbers) pivot can't really help you here
what i would try to do is to create a dynamic query that will seperate the values into multiple columns and then try to work with it, for example
1. get max(bitwise field)
2. log2 on that value will give number x
3. generate a select statement with x columns from 1 to x, each performing an bitwise add operation with the string 0000000i000 (where i is between 1 and x)