Insert hex string value to sql server binary field is appending extra 0
Posted
by rotary_engine
on Stack Overflow
See other posts from Stack Overflow
or by rotary_engine
Published on 2010-04-17T09:33:09Z
Indexed on
2010/04/17
9:43 UTC
Read the original article
Hit count: 218
sql-server-2008
Have a binary field and want to insert into this from a hex string:
insert into binaryTable(binaryField) values(convert(varbinary(max), 0x0))
however when I run select the value is return with an extra 0 as 0x00
This extra 0 is causing a problem in another application, I dont want it.
Interesting, is if I do a select on an existing value and it returns say 0x55 then inserting this same value using the above query will return a select of 0x055.
How to stop the extra 0 being added?
© Stack Overflow or respective owner