views:

353

answers:

2

Hi,

I'm trying to attach a database(db2.sqlite) to a currently open database(db1.sqlite) and copy the contents of one of the tables in db2 into one of the tables in db1. The logical way to do this I thought was to use the attach command and then select all from db2 and insert into db1:-

attach 'C:\db2.sqlite' as newData; insert into main.table1 select * from newData.table1

Both database's have identical table names (table1) and the exact same schema. To make sure my syntax was correct I tried this out in the Firefox SQLite Manager and everything worked perfectly.

Unfortunately when I tried the same method in my air application I got the following error:- "ATTACH is not allowed from SQL.', operation:'execute', detailID:'2053'"

Can anyone please tell me why this isn't working?

Many Thanks Adam

+2  A: 

From the Adobe LiveDocs:

The following SQL elements and SQLite features are supported in some SQLite implementations, but are not supported in Adobe AIR. Most of this functionality is available through methods of the SQLConnection class:

* ATTACH: This functionality is available through the 
  SQLConnection.attach() method.
barrowc
A: 

Brilliant! I'm a little new to the SQLConnection class and was trying to do it entirely through sql statement execution. Clearly not correct but tiredness kicking in certainly doesn't help ;-)

Thank you very much for your help

Kind Regards Adam