Board index » delphi » Copy data from another database
foxcraft
![]() Delphi Developer |
foxcraft
![]() Delphi Developer |
Copy data from another database2006-01-20 05:32:39 PM delphi19 I have 2 database A = 192.168.0.1:C:\DATA\TEST.GDB B = 192.168.0.2:C:\DATA\TEST.GDB I wan to copy some data from A to B. INSERT INTO TABLE_FROM_DATABASE_B SELECT * FROM TABLE_FROM_DATABASE_A How to write this SQL statement? Please help. Thank |
Antonio Felix
![]() Delphi Developer |
2006-01-20 05:49:30 PM
Re:Copy data from another database
foxcraft escreveu:
QuoteI have 2 database Just use two separate SQL statements one for Select values and the other to Insert. HTH Antonio |
foxcraft
![]() Delphi Developer |
2006-01-20 05:51:07 PM
Re:Copy data from another database
How? can u give me a simple example?
Thank "Antonio Felix" <XXXX@XXXXX.COM>writes Quotefoxcraft escreveu: |
Antonio Felix
![]() Delphi Developer |
2006-01-20 06:34:40 PM
Re:Copy data from another database
foxcraft escreveu:
QuoteHow? can u give me a simple example? ... YourTransaction->StartTransaction(); InSQL->SQL->Clear(); InSQL->SQL->Add( "Select * from SOURCETABLE"); InSQL->Prepare(); OutSQL->SQL->Clear(); OutSQL->SQL->Add( "Insert Into DESTTABLE (FIELD1, FIELDN) values (:FIELD1, :FIELDN)"); OutSQL->Prepare(); InSQL->ExecQuery(); while ( !InSQL->Eof ) { OutSql->Params->ByName("FIELD1")->AsString = InSQL->FieldByName("FIELD1)->AsString; OutSql->Params->ByName("FIELDN")->AsString = InSQL->FieldByName("FIELDN)->AsString; OutSQL->ExecQuery(); InSQL->Next(); } YourTransaction->Commit(); HTH Antonio } You need a separate connection to each Database. TIBSQL *In = new TIBSQL( this ) |
Bill Todd
![]() Delphi Developer |
2006-01-20 09:28:20 PM
Re:Copy data from another database
InterBase does not support SQL statements that access two databases.
Use the free IB DataPump at www.clevercomponents.com/products/datapump/ibdatapump.asp or write a program to move the data. -- Bill Todd (TeamB) |