I am trying to select some varbinary data from TABLE(DATA varbinary(2048)) to my .NET dll without any padding. All my records are currently 64 bytes long but they may vary in the future.
I use a stored procedure that does this:
select substring(DATA, 1, datalength(DATA)) as DATA from TABLE
I would expect this to work but the stream I get in my dll is 2050(2048 + 2) bytes long.
When I hard code the value (select substring(DATA, 1, 64) as DATA from TABLE
) it returns 66 bytes as I would expect.
Am I missing something (obvious)?