I found online that the maximum storage size of a varchar(max) is 2^31-1 bytes (2 GB).
Why the data was truncated when it is over 23678 characters?
I query a byte array column in Postgre table in SSIS. The data is transferred and stored in SQL Server column with varchar(max). It stores only up to 23678 characters.
Thanks robert_volk. When it was transferred as a varbinary(max), it seemed the whole length was transferred over. But when it is cast as varchar(max), the result was "’". Please see the image.
The columns store json data.
Maybe I need help on converting from varbinary(max) to varchar(max). Thanks.
You'd have to look at the raw bytes. Save them to a file and open in a hex editor to see how they are interpreted. Not all bytes streams can be converted to character strings.