Re: how to replace

Поиск
Список
Период
Сортировка
От Owen Jacobson
Тема Re: how to replace
Дата
Msg-id 144D12D7DD4EC04F99241498BB4EEDCC08B412@nelson.osl.com
обсуждение исходный текст
Ответ на how to replace  ("Michael Höller" <MichaelHoeller@t-online.de>)
Список 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
substringto. 

<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


В списке pgsql-sql по дате отправления:

Предыдущее
От: "Michael Höller"
Дата:
Сообщение: how to replace
Следующее
От: "Anthony Molinaro"
Дата:
Сообщение: Re: how to replace