• demonfox (1/28/2013)


    nice and easy ..

    thanks for the question ..

    Also, about the explanation

    The row with Comment 'row 3' is rejected by database engine because decimal integer 2 (which is binary 10) results in an attempt to insert 1 (0 was truncated because it is the least significant digit)

    I don't think, it works like that ; BIT datatype stores only 1,0 or NULL ; (True/False goes as 1 /0). even inserting 7777777 or -1 gets inserted as 1

    ... maybe it works in that way....

    as it does implicit conversion, so the engine has the ability to make sure the bit data types gets the data only what it is suppose to take.

    declare @b-2 int

    set @b-2 = 777777

    select convert(bit, @b-2)

    ww; Raghu
    --
    The first and the hardest SQL statement I have wrote- "select * from customers" - and I was happy and felt smart.