I have a table in SQL Server 2008, which has a column having datatype tinyint. Recently I noticed some very strange behavior. When doing something like
update mytable
set mytinyint = 0
where id = 1
The value in the column mytinyint is NULL. The query below
update mytable
set mytinyint = NULL
where id = 1
also results in the value being NULL. And finally this query
update mytable
set mytinyint = 1
where id = 1
sets the value to to 1.
So my question is: why can't a store the value 0 in a column which should be capable of storing any value between 0 and 255 and NULL??