SQL Server: varbinary or int to store a bit mask?

后端 未结 4 1174
面向向阳花
面向向阳花 2021-02-20 06:45

Is there any advantage of using int vs varbinary for storing bit masks in terms of performance or flexibility.

For my purposes, I will always be doing reads on these bit

4条回答
  •  隐瞒了意图╮
    2021-02-20 07:24

    It is generally considered preferable to use a bunch of bit columns instead of a bit mask. They will get packed together in the page, so they won't take any more room. Although I too always seem to go with an int or bigint column to avoid all of the column name typing.. but with intellisense I would probably go with the bit columns.

提交回复
热议问题