添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
干练的西红柿  ·  String (Java Platform ...·  2 周前    · 
冷静的小刀  ·  python ...·  8 月前    · 
刚失恋的打火机  ·  Mysql ...·  1 年前    · 
狂野的丝瓜  ·  mybatis ...·  1 年前    · 

Please start any new threads on our new site at https://forums.sqlteam.com . We've got lots of great SQL Server experts to answer whatever question you can come up with.

Ive been wondering this for way too long, its time to settle it in my mind :) .. I have a database designed where lots of columns are of TINYINT datatype and store either a 0, or 1 .. Example.. For storing a gender in the gender Column I store a 0 for male and 1 for female .. 0 for nonsmoker, 1 for smoker, 0 for nondrinker, 1 for drinker .. etc, etc..Is it faster doing it like this ?? Or should I store a single Char and have Y or N .. or M or FAny suggestions on speed? I know the second route is definately preferred for making sense :) thanksMike123 Depending on what you are storing, and what tools you use to access your data. Bits are correct for storing Yes/No values, such as Smoker/Nonsmoker, and ADO will interpret the 1/0 as a True/False value instead of as a number. Therefore, it is incorrect for Male/Female, because you will get a True/False out. Between tinyint and char(1) for male and female, there is no space difference, both are one byte unless you use NChar, which is two bytes. As far as intuitive goes, it definitely makes more sense to store an F/M than a number, besides for the fact that a tinyint is up to 255 and you only need 2 possible values.Sarah Berger MCSD