Friday, July 26, 2013

Insert Update Binary data in MS Sql Server

It's easy to insert update the Binary data from a .net application (web/windows).

But If you need to insert/update or copy/paste the data which is already there in the database then it's not possible using the SSMS Table Editor (see attached image), it would give an error "The changed value in the call was not reognized as valid. .Net Framework Data Type: Byte[]

Error Message: You cannot use the Result pane to set this Field data to values other then null".


Solution
Use the SSMS Query editor to do this, i.e.
update TableName set BinaryColumnName = BinaryData

Note: The binary data value should not be enclosed between any single quotes

No comments: