1

Topic: Altering a SQL column type

Just wondering if there's any way to alter a column type once it's been created? For example, if this column was created as:

download_id SERIAL,

could you alter it to:

download_id INTEGER NOT NULL DEFAULT 0,

afterwards?


Cheers,

Matt

2 (edited by kierownik 2008-02-03 20:33)

Re: Altering a SQL column type

You can do that with the Alter table statement:

ALTER TABLE 'here your table' CHANGE 'download_id' 'download_id' INT ( 3 ) NOT NULL DEFAULT 0;

not tested

3

Re: Altering a SQL column type

Cheers. smile Had to alter it's syntax slightly for PgSQL, but it worked a treat. smile Thanks again.