Subject | Re: [firebird-support] Re: alter table question |
---|---|
Author | Milan Babuskov |
Post date | 2006-09-19T19:54:52Z |
adsieben wrote:
alter table demo add temp_value char default 'n';
alter table demo alter temp_value to value;
overwritten by the UPDATE statement.
--
Milan Babuskov
http://swoes.blogspot.com/
http://www.flamerobin.org
> create table demo(Here's somewhat simpler version:
> id integer,
> value char default 'y'
> );
>
> You want to change "value" to default 'n':
> First you have to add a new temporary field:Instead of this, create a field with new default at once:
> alter table demo add temp_value char;
alter table demo add temp_value char default 'n';
> Copy all entries from field "value" to "temp_value":Good. Now, simply rename the temporary column and you're done:
> update demo
> set temp_value = value;
>
> Drop the original field:
> alter table demo drop value;
alter table demo alter temp_value to value;
> I don't know by heart, if the existing fields are filled with theOnly when you don't name them in a statement. In this all records are
> default value.
overwritten by the UPDATE statement.
--
Milan Babuskov
http://swoes.blogspot.com/
http://www.flamerobin.org