Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: Copy Table

0 views
Skip to first unread message

Bill Todd

unread,
Sep 28, 2005, 10:28:33 AM9/28/05
to
Use IB DataPump. You can find it with Google.

--
Bill Todd (TeamB)

Robert T

unread,
Sep 28, 2005, 10:25:54 AM9/28/05
to
What is the best way to copy a table from one database to another (if there
is a way).


Robert T

unread,
Sep 29, 2005, 2:39:07 AM9/29/05
to
Sorry Bill, I meant with my program at runtime. I have two databases. Only
the "Stock" table on database 1 is going to be altered with new stock and
changes. Every now and then I want to select a subset from "stock" table in
database1 and I then want to copy this to "Stock" table of database2.

Currently I will select the related data from database1 with Query2 and run
through the following loop until eof. QTempFiles is from Database2.
I use TQuery components and the bde

begin
QTempFiles.Insert;
QTempFiles.Edit;
for n := 0 to Query2.FieldCount - 1 do
QTempFiles.Fields[n] := Query2.Fields[n];

QTempFiles.Post;
end;

Is this a good way of doing it or is there a better way?


"Bill Todd" <n...@no.com> wrote in message
news:433aa891$1...@newsgroups.borland.com...

Martijn Tonies

unread,
Sep 29, 2005, 5:28:10 AM9/29/05
to
> Sorry Bill, I meant with my program at runtime. I have two databases.
Only
> the "Stock" table on database 1 is going to be altered with new stock and
> changes. Every now and then I want to select a subset from "stock" table
in
> database1 and I then want to copy this to "Stock" table of database2.
>
> Currently I will select the related data from database1 with Query2 and
run
> through the following loop until eof. QTempFiles is from Database2.
> I use TQuery components and the bde
>
> begin
> QTempFiles.Insert;
> QTempFiles.Edit;
> for n := 0 to Query2.FieldCount - 1 do
> QTempFiles.Fields[n] := Query2.Fields[n];
>
> QTempFiles.Post;
> end;
>
> Is this a good way of doing it or is there a better way?

This is the worst way :-)

Create an INSERT statement with parameters. Assign the
parameter values and use ExecSQL for each row in the
original. This is by far the fastest.


--
With regards,

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Server
Upscene Productions
http://www.upscene.com
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com


Robert T

unread,
Sep 29, 2005, 6:42:51 AM9/29/05
to
I did not actually want to use parameters but looks like if I want better
speed I will have to.

Do I need to know the fieldtype when using parameters?


"Martijn Tonies" <m.to...@upscene.removethis.nospam.com> wrote in message
news:433b...@newsgroups.borland.com...

0 new messages