On Sep 3, 2006, at 12:21 AM, Carlos M wrote:

On Sep 03, 2006 5:11 AM, Charles Yeomans wrote:

Hmmm.  Is there some something like

INSERT INTO Table1 (1, 'foo') IF NOT EXISTS (SELECT * FROM Table1
WHERE Table1.keyField=1)

available?

Is keyField A PRIMARY KEY? If yes, you can use the "ON CONFLICT"
clause when inserting rows to test if there is already one with same
key. Example:

INSERT OR IGNORE INTO Table1(1, 'foo')

The record is not inserted because there's already one.

To see what "ON CONFLIT" clauses you can use check:
http://www.sqlite.org/lang_conflict.html


I found that; it's a nice construction. Unfortunately, I need to write code that works both with SQLite and M$ SQL Server to the extent possible. And I need to do it yesterday.

Charles Yeomans
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to