Re: Calculated update

Поиск
Список
Период
Сортировка
От Bosco Rama
Тема Re: Calculated update
Дата
Msg-id 4F5E973F.4060807@boscorama.com
обсуждение исходный текст
Ответ на Calculated update  (Bret Stern <bret_stern@machinemanagement.com>)
Ответы Re: Calculated update  (Bret Stern <bret_stern@machinemanagement.com>)
Список pgsql-general
Bret Stern wrote:
>
> trying to update a varchar numeric string column
> by converting it to int, adding a numeric value and insert it back
> as a varchar
>
> Having trouble with cast

I assume you are doing an update as opposed to an insert.  You use
both above (and both numeric and int as well).  Anyway, try:

    update tbl set col = (col::int + 1);

or some variation thereof.  That should do the trick.

Bosco.

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

Предыдущее
От: Martin Gregorie
Дата:
Сообщение: Re: Matching on keyword or phrases within a field that is delimited with an "or" operator "|"
Следующее
От: Bret Stern
Дата:
Сообщение: Re: Calculated update