0

I am inserting varbinary using following SQL:

CREATE TABLE [dbo].[documentUpload](
      [fileName] [nvarchar](150) NULL,
      [fileContent] [varbinary](max) NULL,
)

INSERT INTO documentUpload (fileName,fileContent)       
VALUES('03Sep2014635453570092420104Appendix A3.4 – Registration Of Market Makers.pdf',0x255044462D312E350D0A25B5B5B5B50D0A312)

But it add 0 after 0x and data in the varbinary column looks like,

0x0255044462D312E350D0A25B5B5B5B50D0A312

I need help how I can avoid 0 after 0x while inserting into varbinary column.

Thanks in advance.

1 Answers1

2

The values are identical.

You are looking at a display string of hexadecimal digits; each byte must have a 2 character representation and MSSQL pads accordingly (your input should probably be inserting correctly formatted/padded in the first place).

Alex K.
  • 171,639
  • 30
  • 264
  • 288