I need to fix some data conversion issue in SQL server 2008. I got some requirement change on storing the data. Without much care I converted existing
varbinary data to
CONVERT(NVARCHAR(max), @bytearraydata, 1).
The same conversion in C# is done using
Encoding.Default.GetBytes(string) gets back the bytearray as it was earlier. But when I try to get back the byte array of string which I converted using
CONVERT() gives me a wrong result.
My work is to fetch byte array stored as string the database and convert it to byte array and finally render the content as PDF. Data going through encoding mechanism (while saving and while fetching) works fine for me. But when I try to fetch the data which was converted using
CONVERT it is failing to generate PDF.
How can I resolve this problem?
Byte array column has been changed to string.
Existing data conversion done using this function:
Convert(NVARCHAR(MAX), @bytearraydata, 1)
In the application byte array conversion is done using
CONVERT not compatible?