Using Bit Mask and SQL Server Binary Data Type

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mr. Clean

    Using Bit Mask and SQL Server Binary Data Type

    I need to store flags for the display of comments in our application.
    I would like to use a bit mas to determine if the flag is set, this flag
    can have up to 16 combinations from these values:

    10000 = 16 All
    01110 = 14 PM, EMR, LIS
    01101 = 13 PM, EMR, MED
    01100 = 12 PM, EMR
    01011 = 11 PM, LIS, MED
    01010 = 10 PM, LIS
    01001 = 9 PM, MED
    01000 = 8 PM Only
    00111 = 7 EMR, LIS, MED
    00110 = 6 EMR, LIS
    00101 = 5 EMR, MED
    00100 = 4 EMR Only
    00010 = 2 LIS Only
    00011 = 3 LIS, Med
    00001 = 1 MED Only
    00000 = 0 None

    I found this FAQ: http://vbcity.com/forums/faq.asp?tid=59165
    However, would the SQL Server binary type length be set to 1 for the
    above values? Or should I use a tinyint field to store this value?
Working...