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