Subject RE: [IBDI] Defining a default value to an existing column
Author Claudio Valderrama C.
Here's a safe way:

select rdb$field_source
from rdb$relation_fields
where rdb$field_name = 'OR_SITUATION'
and rdb$relation_name = 'ORDERS'

This will give your a name like rdb$15, then using this example, you would
do

ALTER DOMAIN rdb$15 SET DEFAULT '10000000';
commit;

This form of the alter domain syntax exists since IB4.0.

Now if your table has records, update them now to avoid on-the-fly
conversion (and hence, overhead) to the new definition each time you do a
query:

update orders set or_situation = or_situation;
select * from orders;
commit;

C.

> -----Original Message-----
> From: Paulo Albuquerque [mailto:paulo.albuquerque@...]
> Sent: Jueves 8 de Junio de 2000 10:17
> To: IBDI@egroups.com
> Subject: [IBDI] Defining a default value to an existing column
>
>
> What is the command syntax for defining a default value to an
> existing column on a Interbase 6.0 table on WISQL ?
> I tried something like:
>
> ALTER TABLE ORDERS ALTER COLUMN OR_SITUATION TYPE VARCHAR(8)
> DEFAULT '10000000';
>
> but it always returns a SQL error.
>
> Thank you in advance,
>
> Paulo
>
>
>
> ------------------------------------------------------------------------
> Take your development to new heights. Work with clients like Dell and
> pcOrder. Submit your resume to jobs@.... Visit us at
> http://click.egroups.com/1/4358/4/_/679568/_/960473816/
> ------------------------------------------------------------------------
>
> Community email addresses:
> Post message: IBDI@onelist.com
> Subscribe: IBDI-subscribe@onelist.com
> Unsubscribe: IBDI-unsubscribe@onelist.com
> List owner: IBDI-owner@onelist.com
>
> Shortcut URL to this page:
> http://www.onelist.com/community/IBDI
>