"Neville Franks" <[EMAIL PROTECTED]> wrote
in message news:[EMAIL PROTECTED]
> I have a table where two columns must be unique so I've specified
> UNIQUE( tagid, recid ) in the Create Table.
>
> It is perfectly valid, but infrequent, for an insert to occur where
> the constraint will fail. In this scenario I'm wondering whether it is
> best practice to always do a select first and not proceed with the
> insert as required, or just handle the conflict as being acceptable
> vs. an exception?

A third alternative is to use INSERT OR IGNORE statement. This way, any 
conflicting rows are just silently dropped on the floor. You may also 
want to study other conflict resolution options.

Igor Tandetnik



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

Reply via email to