Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Modify binary(1) column in SSMS grid

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.

like image 774
BlackViking Avatar asked Aug 03 '13 19:08

BlackViking


1 Answers

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.

like image 161
Mikael Eriksson Avatar answered Nov 15 '22 12:11

Mikael Eriksson