Tag: The code type will also query src update image creat BSP
The bit Type field before the first look at the "weird" scene, to perform the update successfully, but the results of the query is still 1, not the update of 2
When others asked me to come, I was also in a state of confused, behind Lenovo specific business suddenly remembered that this field is a bit type
It is not surprising that this phenomenon is contiguous with the bit Type field.
Not much nonsense, directly on the code to see the result is good.
Build a test table first
CREATE TABLE testbit ( INTIDENTITY(1,1), BIT)
As a rule, the bit Type field can only be 0 or 1, so direct inert 0 or 1 is of course no problem.
Because bit is a true or false value, it is not a problem to assign the string to False or true at insert time.
Of course the text only supports false or true of the two strings, the other will be error, from the error will also be found in the insert when there is an implicit conversion
For numeric data: When execution inserts a value other than 0 or 1, it is inserted successfully, but the value of the insertion (not 0) is implicitly converted to 1.
Inserting a value other than 0 is converted to 1, which is true
The update is the same if the update is a numeric value, the updated string can only be false or True
If the update is a numeric value and the value is not 0 (integer or negative), it is equivalent to updating the bit field type to 1
bit type field in SQL Server Delete and change the thing.