I suggest to use the CloneTable function
Have a look at
https://www.gaia-gis.it/fossil/libspatialite/wiki?name=CloneTable

It copies the table and all of its triggers, indexes, etc.

Maurizio

2015-03-26 16:35 GMT+01:00, John McKown <john.archie.mckown at gmail.com>:
> On Thu, Mar 26, 2015 at 10:29 AM, Nigel Verity <nigelverity at hotmail.com>
> wrote:
>> Hi
>>
>> I know this must seem a fairly dumb question, but I can't find an easy way
>> to create a copy of table using just SQL.
>>
>> My requirement is to take periodic snapshots of a names and addresses
>> table, to be stored in the same database as the master.
>>
>> The master table has one index - an auto-incrementing integer ID (non
>> NULL, primary key). There is no need for the corresponding field in the
>> snapshot to be indexed, but the integer ID does need to be copied across.
>>
>> I'm happy to copy the table structure in one operation and the data in
>> another, but if it can be done in a single operation so much the better.
>
> You could use _two_ statements like:
>
> DROP TABLE IF EXISTS copy_of_bubba;
> CREATE TABLE copy_of_bubba AS SELECT * FROM bubba;
>
>>
>> Thanks
>>
>> Nige
>>
>>
>>
>> _______________________________________________
>> sqlite-users mailing list
>> sqlite-users at mailinglists.sqlite.org
>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
>
>
> --
> If you sent twitter messages while exploring, are you on a textpedition?
>
> He's about as useful as a wax frying pan.
>
> 10 to the 12th power microphones = 1 Megaphone
>
> Maranatha! <><
> John McKown
> _______________________________________________
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>

Reply via email to