0

I am inserting Binary data into the one of my tables with a column having datatype varbinary(max).

The total length of the binary data which I am inserting is 610154 characters long.

While after inserting the data either through the code or manually by SSMS, only a part of that gets inserted (43679 characters only).

I did check if there are any triggers or constraints tied to the column in which I am trying to insert the data to, but there aren't any.

As per my previous search on stackoverflow , the (max) means I could insert 2^31 bytes. I also confirmed by looking into the trace that I am sending in the complete information (610154 length)

Any help would be appreciated.

Thanks in advance.

Ram Mehta
  • 449
  • 1
  • 6
  • 20
  • 1
    Exactly how are you inserting the data? Can you post your code? What does `DATALENGTH()` tell you the inserted column length is? – Bacon Bits Mar 31 '16 at 17:45
  • @BaconBits - Yup, the DATALENGTH() in the code gives me the exact number of bytes I am trying to insert. Some how I am not able to see that when I select the value. – Ram Mehta Apr 01 '16 at 05:39
  • 1
    It means your INSERT is working just fine, and the data is in the DB. It's that [SSMS isn't displaying the entire record](http://stackoverflow.com/questions/14880324/copying-a-large-field-varbinarymax-to-file-clipboard). If you query with PowerShell, for example, you should see the full value. There may be a limitation on the provider you're using in your code. – Bacon Bits Apr 01 '16 at 20:54

1 Answers1

0

Is it possible that all of your data is actually being inserted, but somehow SSMS is only returning a portion of the data when you run a query to check if it is there? Check the TEXTSIZE property by running the following...

SELECT @@TEXTSIZE

Or within the SSMS Options...

enter image description here

What is TEXTSIZE set at for you?

Noel

Community
  • 1
  • 1
Isaac
  • 3,240
  • 2
  • 24
  • 31