问题
Following is the error I get when I try to modify / insert 1
or 0
into a binary(1)
column:
Invalid value for cell (row 4, column 5).
The changed value in this cell was not recognized as valid.
.Net Framework Data Type: Byte[]
Error Message: You cannot use the Result pane to set this Field data to values other than NULL.
Type a value appropriate for the data type or press ESC to cancel the change.
回答1:
That is just the way it is for binary fields. You have to write an update statement to modify the value or an insert statement to add a row with a value.
If your column can have only the values 0 or 1 you should use a bit instead. bit
columns can be modified directly in the edit grid in SQL Server Management Studio. binary(1)
can hold the values 0x00
to 0xFF
.
From Working with Data in the Results Pane
Values for columns with a binary data type will have NULL values by default. These values can't be changed in the Results pane.
来源:https://stackoverflow.com/questions/18036745/modify-binary1-column-in-ssms-grid