Kees Nuyt wrote:
On Tue, 04 Sep 2007 07:53:08 -0600, you wrote:
I have an application that is inserting a record every second. There
are thousands of periods from a few seconds to hours long where the data
in all the columns is identical thus causing hundreds of thousands of
duplicate rows.
Is there a way to set up the INSERT statement to allow the insertion of
a new row of data, where one or more columns has data != to the previous
insertion, but ignore or skip the insertion of a duplicate row?
Scott
Perhaps: Specify all columns in the primary key, or define a
separate table constraint UNIQUE (on,all,columns) ON CONFLICT
IGNORE.
The insert will fail. It depends on the conflict-clause what
happens.
Or you can use INSERT ... ON CONFLICT IGNORE.
http://www.sqlite.org/lang_conflict.html
This may do what is needed, or it may not.
This would skip an insertion that matched any previous data, even from
days earlier with many samples of different data in between. If the data
contents don't allow that, your scheme will work.
Otherwise I think a TRIGGER could do what is needed.
HTH,
Gerry
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------