I have a binary file (uploaded .txt file with some code on every row CRLF) in my SQL server.
When I execute the following code:
SELECT CAST(TheBinary as varchar(Max)) FROM MyTable
I get a string of the file in the results as expected. However, when I copy this result and paste this string back in a new notepad, the line breaks and new lines do not follow and everything is kept in a single line.
I know the newline and carrige returns are there in the string because I tried REPLACE function on char(10) and char(13) and it replaces those. I also tried to "print" the results back into an empty file and the newlines are there.
The issue is simply when I copy and paste the contents of the select in the results in SSMS.
What can I do to make it copy the new lines correctly?