Re: Only updating part of a column

Поиск
Список
Период
Сортировка
От Thomas Lockhart
Тема Re: Only updating part of a column
Дата
Msg-id 397D2954.9818573F@alumni.caltech.edu
обсуждение исходный текст
Ответ на Only updating part of a column  (Dave Smith <dave@candata.com>)
Список pgsql-general
> I would like to know if I can update part of a column. ie
> update myfile set substr(direct_key,1,10)='1234567890' where
> substr(direct_key,1,10)='0987654321';

update myfile
  set direct_key = '1234567890' || substring(direct_key from 11)
  where substring(direct_key from 1 for 10) = '0987654321';

Note that you can use substr() also...

                    - Thomas

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

Предыдущее
От: Ian Turner
Дата:
Сообщение: function language type?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: 4 billion record limit?