Indigo Rose Software
  #1  
Old 3 Weeks Ago
gvanassche gvanassche is offline
Forum Member
 
Join Date: Nov 2004
Location: Belgium, Leuven
Posts: 85
Merge SQLite3 database files

Dear all,

I looked for a way to merge SQLite3 database files. I have several files with the same structure (1 table, all the same field names) and I want to get the all data in 1 file. I did not find an SQL command to do this. Does anyone know a way to do this?

thanks

gert
Reply With Quote
  #2  
Old 3 Weeks Ago
reteset's Avatar
reteset reteset is offline
Indigo Rose Customer
 
Join Date: May 2006
Location: <windows.h>
Posts: 649
if your databases are small like : ~10 MB
you can load and export database fields to a XML in memory and close database
then open your main database and import that XML into main database

for example

Step 1 :

Code:
anydb:open()
query databse and fill a XML structure in memory 
anydb:close()
now your database entries in memory in XML form

Step 2 :

Code:
maindb:open()
run a loop on prepared XML and
and insert records to main database
maindb:close()
CleanupXML()
and goto step 1 for another database
__________________
Reply With Quote
  #3  
Old 3 Weeks Ago
gvanassche gvanassche is offline
Forum Member
 
Join Date: Nov 2004
Location: Belgium, Leuven
Posts: 85
Smart, I'll give that a try, but my db will be quite big...

This was what I was trying to do (from command line):

> sqlite> attach 'c:\test\b.db3' as toMerge;
>
> sqlite> insert into AuditRecords select * from toMerge.AuditRecords;
COMMIT;
>
> sqlite> detach database toMerge;

But I could not figure out how to do the COMMIT.

thanks for your help.
I really appreciate it.

gert
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT -6. The time now is 08:41 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright © 2000 - 2009 Indigo Rose Corporation. All rights reserved.
Indigo Rose Software