Subject Re: [firebird-support] Exporting insert statements - qli?
Author Svein Erling Tysvaer
What do you intend to do with the output?

I'm asking because it takes time to prepare a statement, and if you have
100000 insert statements that you want to execute, that is going to
take considerably longer than preparing a statement once, fill in
parameters 100000 times and execute the already prepared statement
100000 times.

And if you have two databases available simultaneously and you want to
transfer from one table in one database to another table with identical
structure in the other database, then qli can do this for you with just
a few statements (I've done that once or twice, but a long time ago, and
don't even remember where I saw the example I copied).

If you know which table and fields you want to export, then I think you
could even use isql to create the insert statements for you, e.g. I
would expect something like:

SELECT 'INSERT INTO PERSON(PID, NAME, COUNTRY) VALUES '||PID||',
'''||NAME||''', '''||COUNTRY||''''
FROM PERSON

to produce a result similar to:
INSERT INTO PERSON(PID, NAME, COUNTRY) VALUES 1, 'Set', 'Norway'
INSERT INTO PERSON(PID, NAME, COUNTRY) VALUES 2, 'Helen', 'Australia'
INSERT INTO PERSON(PID, NAME, COUNTRY) VALUES 3, 'Martijn', 'Holland'

(though I don't use isql myself, and don't know how to export to a
textfile).

HTH,
Set

Smarts Broadcast Systems wrote:
> I'm doing my best to read the ``qli_syntax.pdf'' manual but am finding
> the going rough, hence this plea for help.
>
> The goal is to dump the contents of a table into a text file of
> ``INSERT'' statements. There are mentions of such capabilities with
> third-party GUI tools but I am hoping that a non-graphical, scriptable
> command-line tool such as ``qli'' already has that capability.