Are there reasons for not storing boolean values in SQL as bit data types?

后端 未结 11 1648
北恋
北恋 2020-12-29 02:44

Are there reasons for not storing boolean values in SQL as bit data types without NULL? I see them often stored as integers without constraints to limit values to 0 and 1,

11条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-29 03:06

    We always store the data as a bit, it's small, and more importantly this is the case it is designed for.

    We have had times where the end user was going to be working with the data directly, and to them, Yes/No or Y/N was more readable. In this case, we just created a view that reflected the friendlier data display.

提交回复
热议问题