copy table in dbpro - Forum

Forum Navigation
You need to log in to create posts and topics.

copy table in dbpro

Hello
in dbpro, Is it possible to copy all the contents of one table to another table?

@s7shanbe

Is it possible to copy all the contents of one table to another table?

It does not appear that there is a native neoDBpro command to do this, but you can use dbpExecSQL ...

https://neodbprohelp.visualneo.com/AdvancedSQL.html

to accomplish this ... here ...

https://www.w3schools.com/sql/sql_select_into.asp

.. you will find the syntax of the native SQL command.

@s7shanbe

I would export to an external file and then import into a new table.
Or you can copy one record at a time in a loop.
There are probably other ways, I haven't tried them.

@s7shanbe
@vadim

To copy Tables ...

dbpExecSQL "nameOfYourDatabaseIdHere" "syntax of SQL goes here" ""

Syntax of SQL ...

a) make a copy of a table in the same database ...

SELECT * INTO nameOfYourNewTable FROM nameOfTheTableToBeCopied;

b) make a copy of a table in another (existing) database ...

SELECT * INTO nameOfYourNewTable IN 'anotherDatabase.mdb' FROM nameOfTheTableToBeCopied;

 

If you run into problems, just holler.

Vadim has reacted to this post.
Vadim