Subject Re: Set Firebird generator value from SP
Author majstoru
--- In firebird-support@yahoogroups.com, "Adam" <s3057043@...> wrote:
>
> > How can I write a SP or query statement in the FirebirdSQL that
will
> > set all Genrators to 0, or to get last value from tables and put
it in
> > to the generator value?
>
> 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
interest
> to you. A For select statement could retrieve the generator name and
> 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
you

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