Amazing, I expected to google and find an answer to this within a few seconds, but I've now spent 1/2 hour and tried many methods:
I need to rename a table if it exists, here's a couple of attempts:
var sql = "IF NOT EXISTS 'zones' ALTER TABLE 'sensors' RENAME TO 'zones';";
var sql = "ALTER TABLE if exists 'sensors' RENAME TO 'zones';";
Any idea how I can achieve this ??
Alter table doesn't contain any such syntax: http://www.sqlite.org/lang_altertable.html
Simplest way of going about this would be to have a query finding out if the table exists, and if this returns a value then alter the table name
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With