One of the columns uses ntext. I want to replace the newlines and carriage returns in to space but I can only do it one at a time. Is there a way I could use CHAR(10)
and CHAR(13)
at the same time using the script below on SQL Server 2012?
REPLACE(CAST(Description as NVARCHAR(MAX)), CHAR(10), ' ') AS Description
To replace CRLF instances, you could use:
REPLACE(CAST(Description as NVARCHAR(MAX)), CHAR(13)+CHAR(10), ' ') AS Description
To individually replace all CRs and LFs, you could use:
REPLACE(REPLACE(CAST(Description as NVARCHAR(MAX)), CHAR(10), ' '), CHAR(13), ' ') AS Description