I am currently working on modifying the Firebird v database. 1.5.
The database structure will be changed to execute queries from the delphi application using interbase components, the problem I am facing is that I need to run many queries, some of which include creating generators and updating the generator value, the problem is that I need to achieve this as few requests as possible, but it seems to me (at least to me) that it’s really impossible, what I'm trying to do is the following:
CREATE GENERATOR GEN_TABLENAME;
So, I created a generator, now I need to set its value in the current maximum id from the TABLENAME table, for example:
SET GENERATOR GEN_TABLENAME TO (SELECT MAX(ID) FROM TABLENAME);
Now, is there any workaround for this, or am I forced to:
- create generator
- get maximum id
- update generator value
and repeat the process for each table?
I also expected
SELECT
SELECT MAX(ID) AS ID_TABLENAME_1 FROM TABLENAME_1,
...
SELECT MAX(ID) AS ID_TABLENAME_N FROM TABLENAME_N
there will be a workaround to get the maximum id from each table in one command, but this is not the case.
source
share