Subject Re: [firebird-support] Alter Colum to set a Default Value
Author Martijn Tonies
Hello Marius,

> Is it possible to issue a statement to change or set the default value
> for an existing column?
>
> I have tried the following:
> alter table stock alter column StockType type varchar(20) default
> 'Non-Serialised';
>
> But this does not work, it produces an error:
> Invalid token.
> Dynamic SQL Error.
> SQL error code = -104.
> Token unknown - line 1, column 59.
> default.

It depends on the version of Firebird, I believe 2.1 or 2.5 supports this.

> The StockType field is already in the database table with a varchar(20)
> definition, I just need to add a default value for this field.
>
> Any help appreciated.

Download Database Workbench from www.upscene.com - it can add
a default value to existing table columns.

With regards,

Martijn Tonies
Upscene Productions
http://www.upscene.com

Download Database Workbench for Oracle, MS SQL Server, Sybase SQL
Anywhere, MySQL, InterBase, NexusDB and Firebird!

Database questions? Check the forum:
http://www.databasedevelopmentforum.com