how to submit a file with sql to sqlite"

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

how to submit a file with sql to sqlite"

Wensui Liu
dear listers,
i am wondering if there is a way to submit a file with many sql
statements, say several hundred lines,  to sqlite.

thanks for your insight.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: how to submit a file with sql to sqlite"

Gabor Grothendieck
On Sun, Apr 18, 2010 at 12:02 PM, Wensui Liu <[hidden email]> wrote:
> dear listers,
> i am wondering if there is a way to submit a file with many sql
> statements, say several hundred lines,  to sqlite.
>
> thanks for your insight.

C:\tmp2>type a.sql
create table tab (a,b);
insert into tab values(1, 2);
insert into tab values(1, 2);
select * from tab;

C:\tmp2>sqlite3 a.db < a.sql
1|2
1|2
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: how to submit a file with sql to sqlite"

Roger Andersson-2
> -----Ursprungligt meddelande-----
> Från: [hidden email]
> [mailto:[hidden email]] För Gabor Grothendieck
> Skickat: den 18 april 2010 18:17
> Till: General Discussion of SQLite Database
> Ämne: Re: [sqlite] how to submit a file with sql to sqlite"
>
> On Sun, Apr 18, 2010 at 12:02 PM, Wensui Liu
> <[hidden email]> wrote:
> > dear listers,
> > i am wondering if there is a way to submit a file with many sql
> > statements, say several hundred lines,  to sqlite.
> >
> > thanks for your insight.
>
> C:\tmp2>type a.sql
> create table tab (a,b);
> insert into tab values(1, 2);
> insert into tab values(1, 2);
> select * from tab;
>
> C:\tmp2>sqlite3 a.db < a.sql
> 1|2
> 1|2

Or
> type a.sql
create table tab (a,b);
insert into tab values(1, 2);
insert into tab values(1, 2);
select * from tab;

> sqlite3
sqlite> select * from tab;
Error: no such table: tab
sqlite> .read a.sql
a|b
1|2
1|2

_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: how to submit a file with sql to sqlite"

Wensui Liu
In reply to this post by Gabor Grothendieck
very cool!
Thanks, Gabor.

On Sun, Apr 18, 2010 at 12:16 PM, Gabor Grothendieck
<[hidden email]> wrote:

> On Sun, Apr 18, 2010 at 12:02 PM, Wensui Liu <[hidden email]> wrote:
>> dear listers,
>> i am wondering if there is a way to submit a file with many sql
>> statements, say several hundred lines,  to sqlite.
>>
>> thanks for your insight.
>
> C:\tmp2>type a.sql
> create table tab (a,b);
> insert into tab values(1, 2);
> insert into tab values(1, 2);
> select * from tab;
>
> C:\tmp2>sqlite3 a.db < a.sql
> 1|2
> 1|2
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



--
==============================
WenSui Liu
Blog   : statcompute.spaces.live.com
Tough Times Never Last. But Tough People Do.  - Robert Schuller
==============================
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users