I have one :memory: database open and I want to make a copy of it into another 
:memory: database.  When I open the 2nd :memory: database and call attach on 
the first one specifying ':memory:' as the file name, it allows me to do this.  
However when I loop through the tables copying them into the 2nd one, it is 
still empty after this has been done.  I think the first :memory: database 
might be attaching to, uh, itself.

Is there a way to specify the name of a memory database uniquely?  Something 
like ':memory:2'?  Nothing that I've tried works.

-Dave Gierok

-----Original Message-----
From: Dan Kennedy [mailto:[EMAIL PROTECTED]
Sent: Wednesday, February 07, 2007 9:56 AM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] ATTACH and :memory: databases

On Wed, 2007-02-07 at 09:37 -0800, Dave Gierok wrote:
> I would like to attach a :memory: database to another :memory: database.  How 
> is this possible since the ATTACH command requires the database's file name?
>
> ATTACH [DATABASE] database-filename AS database-name
>
> -Dave Gierok

I don't think there are any special issues. Use ':memory:' as the
filename.

[EMAIL PROTECTED]:~> sqlite3 :memory:
SQLite version 3.2.8
Enter ".help" for instructions
sqlite> attach ':memory:' as db2;
sqlite> attach ':memory:' as db3;
sqlite> create table db2.abc(a, b, c);
sqlite> select * from sqlite_master;
sqlite> select * from db3.sqlite_master;
sqlite> select * from db2.sqlite_master;
table|abc|abc|2|CREATE TABLE abc(a, b, c)
sqlite>



-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to