Convert "\n" to actual newline in SQL Server
c#, database, sql, sql-server
Solution
this should do the trick
UPDATE
<tablename>
SET
<fieldname> = replace(<fieldname>,'\n',char(13)+char(10)),
<otherfieldname> = replace(< otherfieldname >,'\n',char(13)+char(10))
Problem
I have a bunch of varchar(255) and varchar(max) fields in a table in MS SQL Server. These are generally formatted messages (email and other). Most of the fields have the actual characters "\n", but actually need a newline character. I don't need to worry about new data going forward, but don't know how to fix the stuff that's currently in the DB. I'm mostly a programmer, not a SQL/DB Guy, so any pointers on how to approach fixing this, or resources to get me started would be appreciated.