Link to home
Start Free TrialLog in
Avatar of jeffrey_b_lee
jeffrey_b_leeFlag for United States of America

asked on

Removing one CR/ LF and/or multiple CR/LF from a single field

We'd like to remove the CR/LF from a single field called "ADDITIONAL_INFO".  The tricky part is, is that there may be one or more CR/LF within the data.  After the CR/LF(s) are removed we need a space between the data.  There may be CR/LF at the beginning and at the end of the field.

For example, "JOHN DOE <cr/lf> <cr/lf> AND JANE DOE <cr/lf>" would become "JOHN DOE AND JANE DOE" as the field.

PS:  We are using SQL Server to connect to DB2 (if that matters).



Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

is this a linked server to db2 or what?
declare @CRLF varchar(2)
set @CRLF = CHAR(13) + CHAR(10)

select .... replace(ADDITIONAL_INFO,@CRLF,'')
from
ASKER CERTIFIED SOLUTION
Avatar of TextReport
TextReport
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial