remove embedded carriage returns

Started by Nonameabout 19 years ago4 messagesgeneral
Jump to latest
#1Noname
chwy_nougat@yahoo.com

Outputting a SELECT statement's results to ascii file showed me a table
with a bunch of embedded carriage return characters in the values. I
want to remove the embedded returns, so I read the documentation and
tried a few variations on "SELECT replace(columname, 'chr(13)','') from
tablename" with no luck. Could someone help me rid this table of its
embedded returns?

Thanks in advance...

#2Noname
chwy_nougat@yahoo.com
In reply to: Noname (#1)
Re: remove embedded carriage returns

chwy_nou...@yahoo.com wrote:

Outputting a SELECT statement's results to ascii file showed me a table
with a bunch of embedded carriage return characters in the values. I
want to remove the embedded returns, so I read the documentation and
tried a few variations on "SELECT replace(columname, 'chr(13)','') from
tablename" with no luck. Could someone help me rid this table of its
embedded returns?

Thanks in advance...

Is there a different board that I should post this question to?

#3Jonathan Hedstrom
jhedstrom@desc.org
In reply to: Noname (#1)
Re: remove embedded carriage returns

chwy_nougat@yahoo.com wrote:

"SELECT replace(columname, 'chr(13)','') from tablename"

Try using chr(13) without the single quotes:

SELECT replace(columname, chr(13),'') from tablename

or you could use '\r' to get the character:

SELECT replace(columname, E'\r','') from tablename

-Jonathan

#4Kj
kurtisj@gmail.com
In reply to: Jonathan Hedstrom (#3)
Re: remove embedded carriage returns

Jonathan Hedstrom wrote:

chwy_nougat@yahoo.com wrote:

"SELECT replace(columname, 'chr(13)','') from tablename"

Try using chr(13) without the single quotes:

SELECT replace(columname, chr(13),'') from tablename

or you could use '\r' to get the character:

SELECT replace(columname, E'\r','') from tablename

-Jonathan

begin:vcard
fn:Jonathan Hedstrom
n:Hedstrom;Jonathan
org:Downtown Emergency Service Center;Information Services
email;internet:jhedstrom@desc.org
title:Data Systems Administrator
tel;work:(206) 464-1570 ext. 3014
version:2.1
end:vcard

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Thanks so much! I am a psql noob and really appreciate your response
and help.