Subject Re: [ib-support] newbie questions
Author Helen Borrie
At 09:11 PM 20-01-02 +0100, you wrote:
>what do you do when creating a new database ?
>
>Do you add tables, indexes, triggers and costraints one by one using IB_SQL
>or the like ?
>
>Or do you create a big script that does everything ?
>
>I guess one needs some sort of journal of all the changes done to a
>database, because it is not easy to retrieve this info from the DB itself.
>
>What do you advice ?

Exactly that. A script not only makes your database recreatable, it also documents everything you did in the order in which you did it. You can (and should) also add comment text.

As for one big script, I never do that. I have several scripts, e.g. for a database named iBook:

iBook0.sql - contains the CREATE DATABASE command, domain declarations, UDF declarations.
iBook1.sql - contains table definitions, constraint definitions, index definitions.
iBook2.sql - contains triggers and stored procedures.
iBook3.sql - contains DML statements to populate control tables.

You can make the scripts run as a batch by using the INCLUDE statement at the end. Please consult the isql documentation (in OpGuide.pdf) for the syntax. While the database is under active development, I prefer to run them manually one by one to be sure that each group of DDL commits safely...

At 11:00 PM 20-01-02 +0100, you wrote:
>how can I run several sql statements one after another from an SQL editor
>like WISQL ?
>
>I'd like to run several INSERTs at a time, like
>
>INSERT INTO TB_ACC
>(
>COD_ACC,
>ACC_UNI
>)
>VALUES (
>'SIN',
>134035
>);
>
>INSERT INTO TB_ACC
>(
>COD_ACC,
>ACC_UNI
>)
>VALUES (
>'SIE',
>134900
>);

Put them in a script.

regards,
Helen


All for Open and Open for All
Firebird Open SQL Database ยท http://firebirdsql.org
_______________________________________________________