Search Postgresql Archives

Re: Calculated update

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux