Subject | Re: [ib-support] Triggers |
---|---|
Author | Lucas Franzen |
Post date | 2001-03-15T13:49:11Z |
Lee Catlett schrieb:
supposed I understood it right, you could do something like:
create trigger BI_MYTABLE FOR MYTABLE
BEFORE INSERT POSITION 0
AS
BEGIN
NEW.SOMEFIELD = 'abc_def_' || CAST ( GEN_ID ( G_MYGENERATOR, 1 ) AS
VARCHAR(12) );
END
this fill the field SOMEFIELD with abc_def_ + the generator-value.
Is this what you're lookung for?
>Lee,
> I may have posted this a week or so ago so my apologies for duplicating
> the question, but I need some input if anyone can help. Can someone
> give me some idea of how to write a trigger that would generate keys
> that would look something like this:
> abc_def_100. I know that getting the 100 is the easy part, but how does
>
> one preface the number with some other literal that could be a constant
> or db derived value??
supposed I understood it right, you could do something like:
create trigger BI_MYTABLE FOR MYTABLE
BEFORE INSERT POSITION 0
AS
BEGIN
NEW.SOMEFIELD = 'abc_def_' || CAST ( GEN_ID ( G_MYGENERATOR, 1 ) AS
VARCHAR(12) );
END
this fill the field SOMEFIELD with abc_def_ + the generator-value.
Is this what you're lookung for?