| From: | "Owen Jacobson" <ojacobson(at)osl(dot)com> |
|---|---|
| To: | "Michael Höller" <MichaelHoeller(at)t-online(dot)de>, <pgsql-sql(at)postgresql(dot)org> |
| Subject: | Re: how to replace |
| Date: | 2005-09-08 21:33:00 |
| Message-ID: | 144D12D7DD4EC04F99241498BB4EEDCC08B412@nelson.osl.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
Michael Höller wrote:
> Hello,
>
> I initially thought this is simple.. I want to relpace a character to
> nothing. Eg. relace "B" to "" -> ABCD to ACD.
>
> All me approches vaild but I am sure that I have seen it already and
> think it was not tricky..
>
> Can someone please help me ?
From the manual:
replace(string text, from text, to text) returns text
Replace all occurrences in string of substring from with substring to.
<http://www.postgresql.org/docs/8.0/interactive/functions-string.html>
To replace only on output, for example:
SELECT replace (sometextcolumn, from 'B', to '') FROM sometable;
To replace the data,
UPDATE sometable SET sometextcolumn = replace (sometextcolumn, from 'B', to '');
HTH,
Owen
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Anthony Molinaro | 2005-09-08 21:40:09 | Re: how to replace |
| Previous Message | Michael Höller | 2005-09-08 21:25:05 | how to replace |