Subject | RE: [firebird-support] Generator as default value? |
---|---|
Author | Helen Borrie |
Post date | 2005-01-24T10:03:10Z |
At 04:56 PM 24/01/2005 +0700, you wrote:
What this will do is generate a new value for the column every time you
select it!! and it won't populate a real column (which a primary key must be).
(Please excuse the shouting...)
./heLen
> >I would like to use a generator to assign unique row numbers forCorrect, you can't.
> >various tables. I am familiar with the approach of defining an insert
> >trigger for each table.
> >Is there a simpler way to achieve this? I was hoping for one of the
> >two options:
> >(1) have the generator as the default value for the column, i.e.
> >something like
> >create table xyz ( xyzID DECIMAL(18) DEFAULT MyGenerator, ...)
>
>
>
>AFAIK, we can't use generator value as default statement,
>but we can useNO! NO! NO!
>them in COMPUTED BY definition, so if I'm not wrong about your meant, you
>can do this :
>
>
>CREATE TABLE XYZ (XYZID BIGINT COMPUTED BY
>(GEN_ID(MYGENERATOR,[somevalue]))
What this will do is generate a new value for the column every time you
select it!! and it won't populate a real column (which a primary key must be).
(Please excuse the shouting...)
./heLen