Thank you very much Set, I will try your advice. Off topic: can you say me what the letters HTH means?
Greetings. Walter. On Wed, Feb 15, 2017 at 6:31 PM, setysvar setys...@gmail.com [firebird-support] <firebird-support@yahoogroups.com> wrote: > > > Den 15.02.2017 17:07, skrev 'Walter R. Ojeda Valiente' > sistemas2000profesio...@gmail.com [firebird-support]: > > Hello everybody > > If I connect to a database "Database1" using ISQL, I can write something > like: > > OUTPUT MyFile.DAT; > SELECT * FROM MyTable; > OUTPUT; > > And all the rows of "MyTable" will go to the text file "MyFile.DAT". > That's ok and works fine. > But now, I want to connect to "Database2", which also have a table called > "MyTable" and with the same structure. > After that, I want to insert into "MyTable" (of "Database2") the rows > contained in "MyFile.DAT" > How can I do such thing without a lot of effort writing an INSERT command > in each line of "MyFile.DAT"? > > Greetings. > Walter. > > > Hi Walter. I'm not directly answering your question (mainly due to not > using isql myself, so I don't know the answer), but I can think of two > alternative ways. > > (1) (the more standard answer) Make sure your output file is in a fixed > length format, then create an external table for this file, transfer the > data using INSERT INTO "MyTable" SELECT * FROM > <FileDefinedWithExternalTable> and then finally drop the external table. > > (2) Use qli rather than isql to transfer data directly using something > similar to this recipe: > https://www.ibphoenix.com/resources/documents/how_to/doc_42 > qli is an ancient part of InterBase, probably used before SQL was > invented, you can find it in the same directory as isql. > > I've only used qli once many years ago (probably on Fb 0.9.4 or 1.5), but > it worked nicely when I needed it. Though I don't think qli has been > updated for the last few Firebird versions, so maybe it doesn't work > anymore. And you may have a hard time finding information about it beyond > the document referred to above. Though I suppose: > > ready "Database1" as src; > ready "Database2" as trg; > trg."MyTable" = src."MyTable"; > > doesn't need much explanation and should be simple for you to try on a > test database. I expect it to replace the target rather than add to it > (though I don't know), but the one time I used qli, I think I was > transferring to an empty table. > > HTH, > Set > > >