Subject Re: [ib-support] Adding a default value for a field
Author Pere Martinez
Add a trigger:

create trigger before update for TableName
as
begin
if (new.IS_DELETED is null) then new.IS_DELETED = 'F';
end^

(Writed from my head. Check the correct syntax)

And not forget to modify the old records:

update TableName set IS_DELETED = 'F' where IS_DELETED is null;

See you.
Pere

Stevio wrote:
>
> What I was actually hoping for was to alter the table in the Firebird
> database so that the Default value property of the field in the
> database is set to the appropriate value.
>
> How do I do that? (Looking back my original question wasn't very
> clear.)
>
> Thanks,
> Stephen
>
> ----- Original Message -----
> From: "joseph osende" <osendej@...>
> To: <ib-support@yahoogroups.com>
> Sent: Thursday, March 21, 2002 4:57 PM
> Subject: Re: [ib-support] Adding a default value for a field
>
>
> > >How can I specify a default value for a field that
> > >already exists in a table ?
> >
> > >The field is called IS_DELETED and is specified as
> > >follows:
> >
> > >IS_DELETED VARCHAR(1),
> >
> > >I want it to have a default value of F (for false)
> >
> > In a delphi App, you can do it in a AfterInsert event
> > of the table
> >
> > You can also do it in a before insert / before update
> > trigger of the table, after checking the value of
> > the old value
> >
> > Hope it helps
> >
> > regards
> > Joseph
>
>
> ------------------------ Yahoo! Groups Sponsor ---------------------~-
> -> Tiny Wireless Camera under $80!
> Order Now! FREE VCR Commander!
> Click Here - Only 1 Day Left!
> http://us.click.yahoo.com/nuyOHD/7.PDAA/yigFAA/67folB/TM
> ---------------------------------------------------------------------
> ~->
>
> To unsubscribe from this group, send an email to:
> ib-support-unsubscribe@egroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo
> com/info/terms/