Re: [sqlite] mode insert dumps

2019-08-05 Thread Luca Ferrari
On Fri, Aug 2, 2019 at 12:03 PM Olivier Mascia  wrote:
> Besides the other answers focused on using .mode insert more precisely, the 
> .dump command might prove useful too.

Yes, but dump will dump all the columns, including autoincrement, that
is something I want to avoid in the final output.

Thanks,
Luca
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] mode insert dumps

2019-08-05 Thread Luca Ferrari
On Fri, Aug 2, 2019 at 10:17 AM Dan Kennedy  wrote:
>sqlite3> .headers on

Yes, but I forgot to mention that I'm using sqlite 3.7.17 (back from
2013), so this option is not working.
However, since I've tested it works on recent versions, I think I
would copy all the databases on a machine with a more recent version
and use such version for the dump.

Thanks,
Luca
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] mode insert dumps

2019-08-02 Thread Olivier Mascia
> Le 2 août 2019 à 10:04, Luca Ferrari  a écrit :
> 
> I've got a lot of database files that I would like to dump using
> INSERT statements.
> unluckily, .mode insert does not work for me, or I'm not able to
> understand how it works.
> 
> sqlite> select mude_anno, mude_numero from catdaemo;
> INSERT INTO table VALUES(2019,1161);

Besides the other answers focused on using .mode insert more precisely, the 
.dump command might prove useful too.

—  
Best Regards, Meilleures salutations, Met vriendelijke groeten, Mit besten 
Grüßen,
Olivier Mascia
https://www.integral.be


___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] mode insert dumps

2019-08-02 Thread Dan Kennedy


On 2/8/62 15:04, Luca Ferrari wrote:

Hi,
I've got a lot of database files that I would like to dump using
INSERT statements.
unluckily, .mode insert does not work for me, or I'm not able to
understand how it works.

sqlite> select mude_anno, mude_numero from catdaemo;
INSERT INTO table VALUES(2019,1161);

My questions are:
1) why is the insert operating against "table" instead of the real
table I was selecting from (catdaemo)?


You can add a table name to the ".mode insert":

  sqlite3> .mode insert catdaemo


2) is there a way to force the INSER to have also the columns I
selected listed? I would like something like:
INSERT INTO catadaemo( mude_anno, mude_numero ) VALUES(2019,1161);


Try doing:

  sqlite3> .headers on

along with the ".mode insert" command.

Dan.


___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] mode insert dumps

2019-08-02 Thread Luca Ferrari
Hi,
I've got a lot of database files that I would like to dump using
INSERT statements.
unluckily, .mode insert does not work for me, or I'm not able to
understand how it works.

sqlite> select mude_anno, mude_numero from catdaemo;
INSERT INTO table VALUES(2019,1161);

My questions are:
1) why is the insert operating against "table" instead of the real
table I was selecting from (catdaemo)?
2) is there a way to force the INSER to have also the columns I
selected listed? I would like something like:
INSERT INTO catadaemo( mude_anno, mude_numero ) VALUES(2019,1161);

The reason is that I want to exclude automatic keys from my inserts
because I'm going to pump those inserts into another database with
automatic keys.

Thanks,
Luca
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users