We have a table in our database for storing photos, the datatype of the actual photo data is varbinary(max).
When inserting a photo from the application, the data is correctly stored and the photo can be viewed as normal.
However, I am updating another record to have the same photo and when I update/insert the existing data, an extra leading 0 seems to be applied to the data thus breaking the decoding of the image.
When the image is inserted by the application, the binary data is correct and starts with: 0xFFD8
When I copy that binary data, and use an update/insert statement to apply this photo to another record, the data changes and starts: 0x0FFD
This means that the data cannot be converted back to an image.
Google has let me down on this occasion, though it may be that I'm not using the correct search terms.
Any assistance greatly appreciated, and if I can add any more info to assist you, in assisting me, please let me know and I'll add whatever I can.
Link to a pastebin showing data before/after insert/update: http://pastebin.com/7jrtivZ8
DECLARE @v varbinary(max) = 0x123; SELECT @v;