Subject | Alter Colum to set a Default Value |
---|---|
Author | Marius Labuschagne |
Post date | 2010-06-03T06:34:39Z |
Hi,
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.
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.
Regards
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.
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.
Regards
Marius