'Create a new table from original table with same fields as the original
txt="CREATE TABLE tblNew (ID INTEGER PRIMARY KEY ,COUNTRY TEXT, POPULATION TEXT)"
SQL1.ExecNonQuery(txt)
'Copy each record from original table to new table
SQL1.BeginTransaction
Cursor1=SQL1.ExecQuery("SELECT * FROM tblOriginal")
For i=0 To Cursor1.RowCount-1
Cursor1.Position=i
txt="INSERT INTO tblNew VALUES(?,?,?)"
SQL1.ExecNonQuery2(txt, Array As Object(i+1,Cursor1.GetString("COUNTRY"),Cursor1.GetString("POPULATION")))
Next
SQL1.TransactionSuccessful
SQL1.EndTransaction
'Delete original table
txt="DROP TABLE tblOriginal"
SQL1.ExecNonQuery(txt)
'Rename new table to original table name
txt="ALTER TABLE tblNew RENAME TO tblOriginal"
SQL1.ExecNonQuery(txt)