Am 05.02.2010 22:33, schrieb Vasanta: > Kittayya: > > My issue is, I already have imported table in the Database, there alreay > around 1000 records in that table where ROWID is from 1 to 1000, now system > generates new events, where ROWID again starts from beginning from 1, now > these new events are overwriting the earlier imported events by "REPLACE > INTO......", I made that change to instead REPLACE, I need INSERT, but now I > need new ROWID (I need to update at the end of previous imported records. I > don't want to overwrite original records. > > > First of all a few questions to make things clear :
1) you import your data with a script that inserts rows with existing rowid's ? after that : 2) you try to insert new rows with INSERT ... but it doesn't work as you expect because you think you need to specify a new unused rowid ? if so : a) don't classify the field rowid in your insert command because sqlite then generates automatically new unused values. b) if your script (from earlier posts) restores your database with sql commands (most likely) then try to avoid using rowid in that script at all. The default behaviour for rowid works fine especially for your problem with only a few thousand entries in the database c) if rowid is your primary key to identify your data, then you depend on a internal feature of the engine and you should change this with a user defined field called id which could also be a autoincrement field similar to rowid for better performanc (integer primary key autoinc --- look at the documentation) your problem is that you try to insert new rows with a rowid and you will only get performance problems when you have to search for the maximum value of a rowid each time you search for a new valid id. try to avoid this by defining your own primary key. At least don't try to specify a rowid value when you insert new rows. Hope this could solve your problem ;) _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users