The db that you open your initial connection to is called main by default. I
haven't had the occasion to use a temp or memory db so I can't comment.

The attach statement works as normal SQL.
attach 'path to your db' as 'some_alias_name'

like
attach 'c:\temp dir\db2.db' as 'db2'

Suppose both files have a table named 'some_table'.

select * from db2.some_table ; /*refers to the attached db*/
select * from main.some_table ; /*refers to the db you first made a
connection with.*/

I find the command line tool wonderful for testing out syntax.

Happy Computing

Adam


On Tue, Jun 8, 2010 at 4:09 PM, Scott Frankel <fran...@circlesfx.com> wrote:

>
> On Jun 8, 2010, at 12:07 PM, Adam DeVita wrote:
>
> > start by doing an open db1 (as main)
> > then attach path to db2 as 'db2'
> >
> > insert into main.table_one_name select * from db2.table_one_name ;
> >
> > This selects all records from db2 and puts them into db1 in one
> > statement.
>
> I've been reading about the ATTACH DATABASE cmd, but was confused by
> the documentation's warnings about main and temp dbs, namings, and
> transactions using :memory:.  I'll take a closer look.
>
> Thanks!
> Scott
>
>
>
>
> >
> > Adam
> > On Tue, Jun 8, 2010 at 3:02 PM, Scott Frankel
> > <fran...@circlesfx.com> wrote:
> >
> >>
> >> Hi all,
> >>
> >> What's the best way to copy data from one db to another?
> >>
> >> Given 2 databases with identical schemas, one full of data and the
> >> other empty, the brute force way would be to perform selects on the
> >> source db, then for each row, perform an insert into the destination
> >> db.  Is there a more efficient way?
> >>
> >> Thanks in advance!
> >> Scott
> >>
> >>
> >> _______________________________________________
> >> sqlite-users mailing list
> >> sqlite-users@sqlite.org
> >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> >>
> >
> >
> >
> > --
> > VerifEye Technologies Inc.
> > 905-948-0015x245
> > 7100 Warden Ave, Unit 3
> > Markham ON, L3R 8B5
> > Canada
> > _______________________________________________
> > sqlite-users mailing list
> > sqlite-users@sqlite.org
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> >
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
VerifEye Technologies Inc.
905-948-0015x245
7100 Warden Ave, Unit 3
Markham ON, L3R 8B5
Canada
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to