On Sep 17, 2005, at 4:35 PM, Alexander J. Kozlovsky wrote:
I want to avoid doing a two step process outside the db... I want to
insert a row only if it doesn't exist already.
IMHO, if you table T1 have a unique key, you may do this
INSERT OR IGNORE T1 VALUES(1, 2, 3);
ahhh! the conflict
If id in your example identifies a row, then by
definition it is unique (probably the primary
key). If you try to insert another row with the
same id, the insert will fail. Why not just
catch the exception or error code?
Regards
> I want to avoid doing a two step process outside the db... I want to
> insert a row only if it doesn't exist already.
IMHO, if you table T1 have a unique key, you may do this
INSERT OR IGNORE T1 VALUES(1, 2, 3);
Best regards,
Alexandermailto:[EMAIL PROTECTED]
I want to avoid doing a two step process outside the db... I want to
insert a row only if it doesn't exist already. REPLACE INTO seems to
almost do the trick, however, seems like it will UPDATE if the row
already exists. I want the row to be left alone if it exists.
Am trying to figure out if
4 matches
Mail list logo