I have a BLOB stored in SQL Server. I've managed to convert it utilizing C/AL code, but I need to determine a way to convert it via SQL Query.
the C/AL code is:
OnAfterGetRecord()
CALCFIELDS(Rec."BLOB_FIELD", Rec."OTHER_BLOB_FIELD");
"BLOB_FIELD".CREATEINSTREAM(Istream);
Istream.READ(TextData);
CLEAR(Istream);
"OTHER_BLOB_FIELD".CREATEINSTREAM(Istream);
Istream.READ(OtherTextData);
//Istream is of type InStream
The above code seems to work just fine. However, for other purposes, I need to convert this within a SQL Query.
I have tried:
SELECT [No_], CONVERT(VARCHAR(MAX),CONVERT(VARBINARY(MAX),[blobField] )) FROM [foo$blobtable]
but I get data that does not seem to make sense
0
Answers
Turn off compression on the field and you can use it from SQL.
With .NET everything (almost) is possible from NAV with Job Que
SELECT [No_], CONVERT(VARCHAR(MAX),CONVERT(VARBINARY(MAX),[blobField]),0) FROM [foo$blobtable]