Re: Converting between varchar and float when updating - Mailing list pgsql-general

From Vibhor Kumar
Subject Re: Converting between varchar and float when updating
Date
Msg-id C3BCAB90-FEA3-4D25-A9E8-AF46D521A286@enterprisedb.com
Whole thread Raw
In response to Converting between varchar and float when updating  (Thomas Larsen Wessel <mrvelle@gmail.com>)
Responses Re: Converting between varchar and float when updating
List pgsql-general
On Apr 28, 2011, at 2:56 PM, Thomas Larsen Wessel wrote:

> UPDATE foo SET bar = TO_VARCHAR( TO_FLOAT(bar) * 2); -- INCORRECT!!!!

If you are sure bar contains float value, then try following:
UPDATE foo SET bar = bar::float * 2;

Thanks & Regards,
Vibhor Kumar
EnterpriseDB Corporation
The Enterprise PostgreSQL Company
vibhor.kumar@enterprisedb.com
Blog:http://vibhork.blogspot.com


pgsql-general by date:

Previous
From: Szymon Guz
Date:
Subject: Re: Converting between varchar and float when updating
Next
From: Dmitriy Igrishin
Date:
Subject: Re: Converting between varchar and float when updating