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.
| Author |
Topic |
|
mikeyh
Starting Member
2 Posts |
Posted - 2007-06-01 : 09:06:42
|
| I was browsing through our database and I noticed that we had some "NULL" values in a field of type bit, even though it already had 1's and 0's. How is this at all possible? |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-06-01 : 09:12:40
|
| It is because Bit datatype supports three values - 1,0 and NULL and since you made column Nullable, there are bound to be NULL values.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-06-01 : 09:15:03
|
| Note that BIT datatype will have NULL too if you define it to have NULL valuesDeclare @b bitSelect @t=NULLSelect @tMadhivananFailing to plan is Planning to fail |
 |
|
|
mikeyh
Starting Member
2 Posts |
Posted - 2007-06-01 : 09:48:44
|
| So does that then also mean that each of those fields takes up 2 bits instead of 1? |
 |
|
|
|
|
|