Re: [firebird-support] Is there an easy way for input rows from a script file?
> On Feb 15, 2017, at 6:31 PM, setysvar setys...@gmail.com [firebird-support] >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 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. For what it's worth, qli won't magically delete existing records. But it probably won't work either Cheers, Ann > > >
Re: [firebird-support] Is there an easy way for input rows from a script file?
Thank you Set, now I know the meaning of HTH. Greetings. Walter. On Thu, Feb 16, 2017 at 4:09 AM, Svein Erling Tysvær setys...@gmail.com [firebird-support]wrote: > > > HTH = Hope this (alternatively: that) helps > > 2017-02-16 3:06 GMT+01:00 'Walter R. Ojeda Valiente' > sistemas2000profesio...@gmail.com [firebird-support] < > firebird-support@yahoogroups.com>: > >> >> >> 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] 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 >>> 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 >>> >>> >> >> >> > >
Re: [firebird-support] Is there an easy way for input rows from a script file?
HTH = Hope this (alternatively: that) helps 2017-02-16 3:06 GMT+01:00 'Walter R. Ojeda Valiente' sistemas2000profesio...@gmail.com [firebird-support] < firebird-support@yahoogroups.com>: > > > 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]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 >> 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 >> >> > > > >
Re: [firebird-support] Is there an easy way for input rows from a script file?
Thank you, Sean Greetings. Walter. On Wed, Feb 15, 2017 at 6:43 PM, 'Leyne, Sean' s...@broadviewsoftware.com [firebird-support]wrote: > > > Walter, > > > 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"? > > The Firebird ISQL tool does not support such a feature. > > You could create 2 output files and then use command line utility to > combine results into single file. > > There are some third-party tools which could allow you to script this > process (I know that IBExpert supports it) > > > Sean > >
Re: [firebird-support] Is there an easy way for input rows from a script file?
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]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 > 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 > > >
RE: [firebird-support] Is there an easy way for input rows from a script file?
Walter, > 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"? The Firebird ISQL tool does not support such a feature. You could create 2 output files and then use command line utility to combine results into single file. There are some third-party tools which could allow you to script this process (I know that IBExpert supports it) Sean
[firebird-support] Is there an easy way for input rows from a script file?
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.