The logic is slipping me right now...
Have a table with multiple rows, some columns that are bit (0,1).
INSERT INTO UserAccessRights (
UserID, AllowPhone, AllowTelevision, AllowComputer, AllowVisitation)
SELECT 434, 1, 0, 1, 1 UNION ALL
SELECT 512, 0, 0, 1, 0 UNION ALL
SELECT 982, 0, 1, 1, 1
Now, I'd like to run the query one user at a time. I'm missing something here, as I can't quite figure out how to only reutrn the results the where the value in the column = 1.
My pseudocode query would be something like...
select uar.userID, sc.columnName
from UserAccessRights uar
JOIN sc.syscolumns sc ON ?? = ??
where uar.userID = 982
and [sc.columnname] = 1
and I would hope to return something like..
982, AllowTelevision, AllowComputer, AllowVisitation
Can anyone point me in the right direction..?