change data type from text to numeric - Mailing list pgsql-general

From Daniel Torres
Subject change data type from text to numeric
Date
Msg-id CAJGorGy=ckXxfHXPqQe-rsUq5BBmpsWM4qZ14OyTZE3Nv-mw+g@mail.gmail.com
Whole thread Raw
Responses Re: change data type from text to numeric  (David G Johnston <david.g.johnston@gmail.com>)
Re: change data type from text to numeric  (Bill Moran <wmoran@potentialtech.com>)
List pgsql-general
Hi everyone,

sorry to bother you with a simple question, (I'm a new user of postgresql), how do I change the data type of a column of text, to numeric or integer?

I tried with:

ALTER TABLE table_name
 ALTER COLUMN col_name TYPE integer
;

It gives me a mistake
ERROR:  la columna  no puede convertirse automáticamente al tipo integer
SUGERENCIA:  Especifique una expresión USING para llevar a cabo la conversión.

translation: the column can't be converted automatically to type integer .... specify an expression using USING to make the conversion. 

I also tried on pgadmin3, but couldn't found how to do it...

thanks,
Daniel


pgsql-general by date:

Previous
From: David Johnston
Date:
Subject: Re: Range type bounds
Next
From: David G Johnston
Date:
Subject: Re: change data type from text to numeric