Yes, "attaching" a database is the right way. Then just loop over all the tables into your database and perform sql statements like:
INSERT INTO backup_table1 SELECT * FROM table1; This should simplify and speedup the backup process considerably... --- Marco Bambini http://www.sqlabs.net http://www.sqlabs.net/blog/ http://www.sqlabs.net/realsqlserver/ On 09/mag/07, at 17:08, Dennis Birch wrote: > Paul, > > Thanks. This sounds like exactly what I was looking for. I searched > the archives for a couple of hours and didn't find anything regarding > this. And certainly not anything with such a clear and detailed > solution. I'll give it a go. > > -- Dennis > > On 5/9/07, Paul Hosking <[EMAIL PROTECTED]> wrote: >> >> Generally I have used the AttachDatabase function to perform cross >> database >> queries. The attachdatbase commands attachs another database file >> to the >> currently connected database. Once attached you can perform cross- >> database >> queries. In order to attach an encrypted database, you must pass >> the correct >> password/encryptionkey for the database to be attached. You can >> also attach >> more than one datbases to a connected database. To detach a >> database you use >> the DetachDatabase command. Closing the connection to the original >> connected >> database automatically detachs the attached databases. >> >> To attach to a connected db, you can attach using something like >> this: >> >> if db.AttachDatabase(File, DatabaseName, EncryptionKey) = >> true then >> return true >> else >> return False >> end if >> >> You can then use the db.SQLExecute to perform a cross database query. >> >> For example if you are connected to "database1" and you attach >> "database2" >> using the AttachDatabase and both databases contain a table called >> "table1" >> with 3 columns "column1","column2" and "column3" you could then >> perform the following query. >> >> db.SQLExecute("INSERT INTO database2.table1 >> (column1,column2,column3) >> SELECT column1, column2, column3 FROM table1 database1 WHERE rowid >> between >> '1' and '10';") >> >> This sql statement should copy the records from table1 in >> database1 for >> column1, column2, column3 and insert the records in the columns for >> database2 (the attached database) if they meet the WHERE criteria. >> The WHERE >> statement is optional but it illustrates how you could get the >> records from >> one REALSQLdatabase from one file to another in particular cases. >> >> You can also mix and match the columns but be aware that when you >> copy from >> one column to another with different datatypes say a varchar to a >> integer >> column the varchar text may be turned into zeros by REALbasic. > _______________________________________________ > Unsubscribe or switch delivery mode: > <http://www.realsoftware.com/support/listmanager/> > > Search the archives: > <http://support.realsoftware.com/listarchives/lists.html> _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives: <http://support.realsoftware.com/listarchives/lists.html>
