Re: to_number function - Mailing list pgsql-novice

From Igor Romanchenko
Subject Re: to_number function
Date
Msg-id CAP95Gq=9gJeSWnx8jsoF8Wffqn3CRe7c+44WeGmThG4sYreH+w@mail.gmail.com
Whole thread Raw
In response to to_number function  ("manno_it@libero.it" <manno_it@libero.it>)
List pgsql-novice
On Wed, Nov 14, 2012 at 11:30 PM, manno_it@libero.it <manno_it@libero.it> wrote:

Hello people,
it is my first post here! Thank you all for any suggestion and help.


I'm a newbie in PostgreSQL.

I'm working on a PostgreSQL table (evaluations) imported from an .xls one in which a column named "score" stores some values. To be able to import the table from .xls I had to set the TYPE of the PostgreSQL column "score" to TEXT, because the data stored are registered in different ways (previous values were generated by FileMakerPro...): NULL, or a number in different ways like: 3 or 3,5, or 3,50 or 3,75... to 10 (which is the maximum number accepted in this column.

I need to convert the TYPE of my column from TEXT to NUMERIC (with the possibility to have decimal numbers with a maximum of 2 characters after the comma). I surfed the PostgreSQL Guide finding the to_number function, but it is really to difficult for me in this moment to understand the way to use it properly according to the variability of my data in the column "store".
Anyone could help me, please?
Bests,
Mauro

 

Hi Mauro.
Can you give us some sample data for your problem (create table and some inserts with sample data) ?

pgsql-novice by date:

Previous
From: James David Smith
Date:
Subject: Re: to_number function
Next
From: Merlin Moncure
Date:
Subject: Re: Query on JSON field type