On Sep 03, 2006 5:29 AM, Charles Yeomans wrote:
>
> 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.

Hmmm... from what I just read on SQLite.org the INSERT statement does
not allow any use of expressions, so I presume that's not possible
with SQLite. The best way would be to separate those inserts for each
db type.

Carlos


_______________________________________________
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