On 3 Sep 2019, at 8:57pm, Peng Yu <pengyu...@gmail.com> wrote:

> If I try to create a table that already exists, sqlite will give me an error. 
> Is there way to issue one command to create a table, but if there is already 
> a table with the same name, drop it then create the new table? Thanks.

Assuming that the new table has a different structure to the old one, do it in 
two commands:

DROP TABLE IF EXISTS MyTable;
CREATE TABLE MyTable ...;

Neither of those commands will generate an error.

If you are sure that the new table has the same structure as the old one, you 
can do

CREATE TABLE IF NOT EXISTS MyTable ...;
DELETE FROM MyTable;
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to