I was trying the following piece of code (see below), The requirement here is very simple, I want the t_id field or ROWID field to be regenerated sequentially even after delete has been performed.
In the below code, I have created a table with 3 fields, Inserted 1000 records, Deleted some middle records, After deletion, I want the ROWID to be regenrated or I want to UPDATE the t_id to regenerate the numbers from 0-N. Please Note: I don't want to create a new table, I don't want to do VACUUM (I'm working on In-Memory database). Anyone knows...? Please reply... Thanks in advance... static const char *TestSqlStats [] = { "CREATE TABLE testTbl (t_id INTEGER, t_name TEXT, t_desc TEXT);", "INSERT INTO testTbl (t_id,t_name,t_desc) VALUES (%d,'%s','%s');", "SELECT * FROM testTbl WHERE t_name LIKE '%%%s%%' LIMIT 100;", }; int main(int argc, char *argv[]) { char *zErrMsg = NULL; int status , i = 0; status = sqlite3_open (database_name, & db_handle); if ( status) { printf("%d", status ); return 0; } /* Create Table */ status = sqlite3_exec (db_handle, TestSqlStats[0], NULL , 0, &zErrMsg); if (SQLITE_OK == status) { char name [30]; char desc [50]; for ( i = 1; i < 1000 && status == SQLITE_OK; i ++) { sprintf(name ,"TableName""%d", i); sprintf(desc ,"Moves the selected control or dialog down""%d", i ); sprintf(queryString , TestSqlStats[1], i, name , desc); status = sqlite3_exec (db_handle, queryString, NULL , 0, &zErrMsg); } sprintf( queryString, "DELETE FROM testTbl WHERE t_name LIKE '%%0%%' AND ROWID BETWEEN 100 AND 200;"); status = sqlite3_exec (db_handle, queryString, callback, 0, &zErrMsg ); sprintf(queryString , "SELECT ROWID,* FROM testTbl WHERE ROWID BETWEEN 100 AND 200;"); status = sqlite3_exec (db_handle, queryString, callback, 0, &zErrMsg ); } } ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------