code_junkie

Tinyint vs Bit

Nov 13th, 2011
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. declare @t table (
  2. descr varchar(10),
  3. myBit1 bit,
  4. myBit2 bit
  5. )
  6. insert into @t values ('test1', 0, 1)
  7. insert into @t values ('test2', 1, 0)
  8. insert into @t values ('test3', 1, 1)
  9. insert into @t values ('test4', 0, 0)
  10.  
  11. select myBit1, count(myBit1) from @t group by myBit1
  12. select myBit2, count(myBit1) from @t group by myBit2
  13.  
  14. myBit1
  15. ------ -----------
  16. 0 2
  17. 1 2
  18.  
  19. myBit2
  20. ------ -----------
  21. 0 2
  22. 1 2
Add Comment
Please, Sign In to add comment