B4J Question Fastest way to read from a db1 table and write to a db2 table?

amorosik

Expert
Licensed User
What is the fastest way to read from a db1 table and write to a db2 table?
I have a procedure which is normally connected to a Firebird db, one of the tables is "articles"
From B4j code I would like to read the information contained in some rows of the "articles" table and write them to the "articles2" table of a Sqlite db
The structure of the two tables is identical
Is it possible to do this with one query hit or do you need to loop through and copy row by row?
 

JohnJ

Member
Licensed User
Longtime User
I know that in DB2 I can insert values into a table using a select on another table like this

insert into table2 (value1,value2,...) select value1,value2,... from table1 where

or

insert into table2 select * from table1 where
 
Upvote 0

amorosik

Expert
Licensed User
I am trying with the following query but so far without success

db_file_name ="C:\test\db_sqlite.db"
SELECT * INTO ARTICOLI2 IN [ODBC;Driver={SQLite3 ODBC Driver};Database=C:\test\db_sqlite.db] FROM ARTICOLI
 
Upvote 0

JohnJ

Member
Licensed User
Longtime User
I am trying with the following query but so far without success

db_file_name ="C:\test\db_sqlite.db"
SELECT * INTO ARTICOLI2 IN [ODBC;Driver={SQLite3 ODBC Driver};Database=C:\test\db_sqlite.db] FROM ARTICOLI
Look at this.
 
Upvote 0

amorosik

Expert
Licensed User
That is correct sintax

SELECT * INTO ARTICOLI2 IN [ODBC;Driver={SQLite3 ODBC Driver};Dsn=Db_Sqlite;Database=C:\test\db_sqlite.db] FROM ARTICOLI
 
Upvote 0
Top