I have a simple question: How to drop all indexes of a sqlite table? I have multiple indexes created with random name.
Regards,
Pentium10
Syntax. The syntax to drop an index using the DROP INDEX statement in MySQL is: DROP INDEX index_name ON table_name; index_name.
The TRUNCATE TABLE statement is used to remove all records from a table. SQLite does not have an explicit TRUNCATE TABLE command like other databases. Instead, it has added a TRUNCATE optimizer to the DELETE statement. To truncate a table in SQLite, you just need to execute a DELETE statement without a WHERE clause.
To get all index names in a database
SELECT name FROM sqlite_master WHERE type == 'index'
For a specific table:
SELECT name FROM sqlite_master WHERE type == 'index' AND tbl_name == 'table Name'
Then in your language, iterate thought the results and drop them
FOR x IN RESULTSET
SQL = "DROP INDEX " & X
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