Syntax to Alter table

Database
Enthusiast

Syntax to Alter table

What's the syntax to alter table:

col(smallint) needs to be changed to integer..

Tbob
2 REPLIES
Enthusiast

Re: Syntax to Alter table

Hi Tbob,

I don't think we can directly alter a column from smallint to integer.
If tried , it gives this error -
3558: Can not alter the specified attributes.
The Explaination of this error says -
Most column attributes cannot be modified after the column is created. Exceptions are those attributes which can be changed without changing the internal storage of the data.

In this case, we are trying to alter the internal storage definition for the column, and thus this operation would not be allowed.

The solution is to Recreate the table with new definition & then copying data from old table to new table.
Enthusiast

Re: Syntax to Alter table

Thanks for the response Mayhan,
I guess I was misinterpreting the DDL manual.

Tbob