I need to store some sort of day-of-week scheduling in database, where I can schedule a record (say it represents a task) for a day or multiple days of the week. I need to h
From the title, I was led here with a situation of having existing bit fields in a table and needing to convert to a single integer field.
In following the example of days-of-week, let's say have 7 individual bit fields that you want to convert into a (bit-mask) integer field named Schedule:
UPDATE T
SET Schedule = Mon * POWER(2,0) +
Tue * POWER(2,1) +
Wed * POWER(2,2) +
Thu * POWER(2,3) +
Fri * POWER(2,4) +
Sat * POWER(2,5) +
Sun * POWER(2,6)