I will instead create a table in the new database and copy data with a select query to new database from the oldone.Hello
Is there any way to copy a table from one database to another in b4a?
Another option different from @jahswant who will be busy momentarily watching his country battle Brazil in the World Cup would be to:But the number and names of the table fields are not known and may change, so I cannot use this method.
strQuery=$"CREATE TABLE IF NOT EXISTS db2.t2 AS SELECT col1, col3, col4, col7
FROM t1"$
SQL.ExecNonQuery(strQuery)
Thank youAnother option different from @jahswant who will be busy momentarily watching his country battle Brazil in the World Cup would be to:
1. You open your first database db1
2. Attach db1 to the second database db2 using the ATTACH DATABASE statement
3. Create the table t2 in the second database like this:
If you need more clarification, come back.B4X:strQuery=$"CREATE TABLE IF NOT EXISTS db2.t2 AS SELECT col1, col3, col4, col7 FROM t1"$ SQL.ExecNonQuery(strQuery)