Insert hex string value to sql server image field is appending extra 0

后端 未结 2 1194
甜味超标
甜味超标 2021-02-13 03:20

Have an image field and want to insert into this from a hex string:

insert into imageTable(imageField) 
values(convert(image, 0x3C3F78...))

how

2条回答
  •  情书的邮戳
    2021-02-13 04:05

    I have just had similar problem and I blame myself.

    It is possible, that you copy just part of data you need. In my case, I added '0' to the end of the blob.

    The cause of this could be copying the value from SQL Management Studio to clipboard.


    insert into imageTable(imageField) values(0x3C3F78...A)

    Select returned: 0x03C3F78...


    insert into imageTable(imageField) values(0x3C3F78...A 0 )

    Select returned: 0x3C3F78...


    I hope this will help.

    Best wishes.

提交回复
热议问题