Saving Bytearray To Varbinary Column In Sql Server Inserts Only One Byte
I have a following problem - I'm trying to save byte[] to database and I just figured out that it works for one byte only. I have number of floats that I convert to byte[] and use
Solution 1:
If you're using a stored procedure, and you've defined your parameter as just varbinary - you'll get a default length of 1 byte as per MSDN documentation:
When n is not specified in a data definition or variable declaration statement, the default length is 1. When n is not specified with the CAST function, the default length is 30.
So if you have a stored procedure with
@MyDataVARBINARYthen you have just one single byte - you need to change that to something like
@MyData VARBINARY(200) or something else that's suitable for you
Post a Comment for "Saving Bytearray To Varbinary Column In Sql Server Inserts Only One Byte"