Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ALTER TABLE

Status
Not open for further replies.

bluegroper

Technical User
Dec 12, 2002
407
AU
Hey forum
This should be easy but I have PBKAC.
Can annybody please help me with correct syntax ?
rate is presently varchar(15), need (25).
TIA's

Code:
ALTER TABLE phonecalls ALTER COLUMN rate TYPE varchar(25)
 
I don't see any error. You could omit the keyword "COLUMN" afaik, but it schouldn't be a problem:

ALTER TABLE phonecalls ALTER rate TYPE varchar(25);

Maybe an export would help, modify the varchar-width, and reimport.
Or add a column rate2 (vc25), fill with data from rate, delete rate, rename rate2 to rate?


don't visit my homepage:
 
Hi

Are you sure you are using PostgreSQL 8.x ? [tt]alter[/tt]ing the [tt]type[/tt] was not supported yet in 7.x version.

Personally I always do it the "long" way :
stefanwagner said:
add a column rate2 (vc25), fill with data from rate, delete rate, rename rate2 to rate
An alternative I never recommend but my colleague uses, is to [tt]update[/tt] the [tt]pg_attibute[/tt] system table directly.

Feherke.
 

using pg 7.4.19
Thx for clues. I shall do it the "long" way.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top