Subject | Re: Set Firebird generator value from SP |
---|---|
Author | majstoru |
Post date | 2006-03-05T09:33:07Z |
--- In firebird-support@yahoogroups.com, "Adam" <s3057043@...> wrote:
Hi Adam,
I found SET GENERATOR name TO int statement in firebird help!
So I can select all my generators and in to for loop set all max
values into generators, but how can I read only part of generator name
taht will represent table name!
For example:
Table: Article
Generator: Gen_Article_Id
I try with SUBSTR(Gen_Article_Id FROM 5 FOR ???), everything I need to
replace ??? with LENGTH(Gen_Article_Id) - 3 but there in no sql
command like this! Do you have a idea how to solve this, it will be a
complete solution for my work?
Thanks again
>will
> > How can I write a SP or query statement in the FirebirdSQL that
> > set all Genrators to 0, or to get last value from tables and putit in
> > to the generator value?interest
>
> This is possible in FB 1.5 or higher using the Execute Statement
> syntax. Read the release notes for that. You will need to obtain a
> list of generators. I do not have FB installed just here, but it is
> the system table RDB$GENERATORS from memory that would be of
> to you. A For select statement could retrieve the generator name andyou
> run the set generator to command. However there is no direct link
> between a generator and a table (unless you maintained such a link
> table in your database). We have a standard naming convention for
> generators gen_[tablename]UID. If you had something similar, then
Hi Adam,
I found SET GENERATOR name TO int statement in firebird help!
So I can select all my generators and in to for loop set all max
values into generators, but how can I read only part of generator name
taht will represent table name!
For example:
Table: Article
Generator: Gen_Article_Id
I try with SUBSTR(Gen_Article_Id FROM 5 FOR ???), everything I need to
replace ??? with LENGTH(Gen_Article_Id) - 3 but there in no sql
command like this! Do you have a idea how to solve this, it will be a
complete solution for my work?
Thanks again