On Fri, Feb 5, 2010 at 3:33 PM, Vasanta <vtan...@gmail.com> wrote:
> 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.
>


Ok. Let's go back to the beginning. I went back and read your earlier
posts. From your attempt to insert a row with "INSERT INTO
trends(UnitID,HeureTrends,DateTrends) VALUES(?,?,?)" it seems like you
have a table that looks like so

CREATE TABLE trends (
  UnitID ??,
  HeureTrends ??,
  DateTrends ??
)

I don't know if UnitID is a Primary Key. Only you know. But, it seems
that you have ~1000 rows in this table. You keep on mentioning ROWID,
but it is not at all clear why you are concerned with ROWID. Your
"system" generates new events which is where, I am guessing, the
insert statement comes in. Whatever this "system" is, it tries to

INSERT INTO trends(UnitID,HeureTrends,DateTrends) VALUES(?,?,?)

I still don't see ROWID being used anywhere here. Now, if your
"system" is over-writing UnitID, you can do something like this

INSERT INTO trends(UnitID,HeureTrends,DateTrends)
VALUES( (SELECT Max(UnitID) + 1 FROM trends), ?, ?)

Once again, if UnitID is defined as a Primary Key, then you won't have
any over-writing as the database will prevent that from happening.

Hope this helps.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to