alter column type

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
forgodsake8
Forum Newbie
Posts: 9
Joined: Fri Feb 27, 2004 8:30 pm

alter column type

Post by forgodsake8 »

Hi,
Is it possible to alter the type of a column in a table?
For example changing an INT to a VARCHAR.
How would I do this using PostgreSQL.
Thanks.

Lou
forgodsake8
Forum Newbie
Posts: 9
Joined: Fri Feb 27, 2004 8:30 pm

Post by forgodsake8 »

Column | Type | Modifiers
--------------+-----------------------------+----------------------------------------------------------------
advert_id | integer | not null default nextval('public.advert2_advert_id_seq'::text)
username | character varying |
mod_book_id | character varying |
asking_price | integer |
condition | character varying |
date_added | timestamp without time zone |
description | character varying |
advert_type | character varying(2)

I basically want to change asking_price to a format where it can accept 12.50 for example...would i need to use float??
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

I removed my posts as I misread your original post and question. I'm now realizing that I was trying to help you achieve this using the MySQL way and not the PostgreSQL way.

I'm sincerely sorry for misleading you. :(

Might find point 4 on this page interesting (the entire page actually): http://techdocs.postgresql.org/techdocs ... olumns.php
Post Reply