Reducing colum length

Database

Reducing colum length

Hi,

I want to reduced the length of a column from varchar (60) to varchar (50), can this be done ?

What is the correct syntax for that

Regards
3 REPLIES

Re: Reducing colum length

I dont think this can be done on a populated column.
You have to drop and re-create table.

Re: Reducing colum length

You can alter the table, add a new column, update the new column to be equal to the value of the old column, then alter the column again dropping the original column.

This is not a recommended approach however unless the table is small. The overhead required to rewrite the data blocks of the table can be significant, which is largely contingent upon row length.

-peter

Re: Reducing colum length

perhaps create insert is better,