Modify binary(1) column in SSMS grid

↘锁芯ラ 提交于 2019-12-10 14:57:48

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!