Count null bit1 values
1>
2> CREATE TABLE T (
3> int1 int,
4> bit1 bit,
5> varchar1 varchar(3),
6> dec1 dec(5,2),
7> cmp1 AS (int1 + bit1)
8> )
9> GO
1> INSERT T (int1, bit1) VALUES (1, 0)
2> GO
(1 rows affected)
1> INSERT T (int1, varchar1) VALUES (2, 'abc')
2> GO
(1 rows affected)
1> INSERT T (int1, dec1) VALUES (3, 5.25)
2> GO
(1 rows affected)
1> INSERT T (bit1, dec1) VALUES (1, 9.75)
2> GO
(1 rows affected)
1> --Count null bit1 values
2> SELECT COUNT(*) 'Count of null bit1'
3> FROM T
4> WHERE bit1 IS NULL
5> GO
Count of null bit1
------------------
2
(1 rows affected)
1>
2> drop table t
3> GO
1>
2>
Related examples in the same category