Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replace carriage returns

Status
Not open for further replies.

rafeman

Technical User
Oct 20, 2004
66
GB
Hi All,

I have an address field with data such as

Sheldruck House : Billericay : Essex

I want to replace the ':' with carriage returns.

I'm sure this is simple but how do I do it?

I've tried

update PL_ACCOUNTS
set SUADDRESS = REPLACE(':',char(10),CHAR(13))

But its not correct.

Thanks
 
Code:
update PL_ACCOUNTS
set SUADDRESS = REPLACE(':',char(10)+CHAR(13))


Borislav Borissov
VFP9 SP2, SQL Server 2000,2005 & 2008.
 
OOPS,
CRLF is CHAR(13)+CHAR(10), not CHAR(10)+CHAR(13)
So:
Code:
update PL_ACCOUNTS
set SUADDRESS = REPLACE(':',CHAR(13)+CHAR(10))

Borislav Borissov
VFP9 SP2, SQL Server 2000,2005 & 2008.
 
If you already ran your own UPDATE, all your SUADRESSES now will be ':' only. You lost your data. Hopefully you have a backup. The result of REPLACE(':',CHAR(10),CHAR(13) is always ':' only, and you put that into all you SUADDRESS fields.


Parameterisation of REPLACE is this way
1. what to use as initial value (SUADDRESS)
2. what to search (':')
3. what to replace it with (CHAR(13)+CHAR(10))

=> repolkaces ':' within SUADDRESS with CRLF.

Restore the data, then do:

Code:
update PL_ACCOUNTS
set SUADDRESS = REPLACE(SUADDRESS,':',Char(13)+CHAR(10))

Bye, Olaf.
 
repolkaces -> replaces

(Don't ask me about my ring size.)

Bye, Olaf.
 
Brilliant, worked a treat. Thanks to you both
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top