How to change the datatype of a column from integer to money?
7
votes
3
answers
29180
views
I am attempting to convert a PostgreSQL table column from integer to money, but I am receiving the error:
>cannot cast type MyColumn to money
I have tried these two statements, but just haven't found any real example on how to really do it.
ALTER TABLE products
ALTER COLUMN price TYPE money
and:
ALTER TABLE products
ALTER COLUMN price TYPE money USING to_char(price, '999.99')
How can you change the datatype of a PostgreSQL column from integer to money?
Asked by Gabriel
(71 rep)
Sep 27, 2011, 12:49 AM
Last activity: Sep 28, 2011, 03:19 AM
Last activity: Sep 28, 2011, 03:19 AM