'Firebird dump tables

I have a database.gdb running with Firebird 3.0.

This database has two tables:

  • Table1 and
  • Table2.

Every day I add records to these tables and when I have finished my work I need to export the two tables to another newer database.

I need a procedure which dumps the two tables into a script so to import data in the newer database using the script.

I am only able to create a script of tables which have always the same number of records (no records added every day).

This script should include:

  1. CREATE TABLE
  2. Export all records procedure of the two tables

I do not need code but just a hint. I will study how to write code by myself.

I have created a handmade script.

CREATE TABLE TABYEARS (
    ID     INTEGER NOT NULL,
    YEARS  INTEGER,
    /* Keys */
    PRIMARY KEY (ID)
);

CREATE TABLE TABCODE (
    ID     INTEGER NOT NULL,
    NAME   VARCHAR(50),
    CODE   VARCHAR(50),
    /* Keys */
    PRIMARY KEY (ID)
);
COMMIT;

INSERT INTO TABYEARS (ID, YEARS) VALUES (1, 2021);
INSERT INTO TABYEARS (ID, YEARS) VALUES (2, 2022);
INSERT INTO TABCODE (ID, NAME, CODE) VALUES (1, 'Robert', '10');
INSERT INTO TABCODE (ID, NAME, CODE) VALUES (2, 'Paul', '87');
COMMIT;

I do not add records very often to these tables. The first one has just one record every year.

How to create (not manually) a script like this but regarding two tables in which every day I add 50 records?

I can use FlameRobin or IBExpert or similar.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source