D
Daniel Anderson
Hi!
I have a database and in one of the table I need to insert some data. This
data has a primary key. often in my input I receive the same data twice, the
insertion fail as it violate my constraint. This all work ok but I have two
problems:
- I need to handle the error when the insertion fail, so that I can ignore
the error
- The odbc driver is outputing to the error to the debug stream output
(outputDebugString)
In MS-SQL I could do:
IF (SELECT count(*) where key = '1') = 0 INSERT into mytable (col1, col2)
values(key, data).
this work fine with MS-SQL, but I cannot find how to do it with the JetDB.
for now I do:
a select with the proper where clause,
If no row returns
Insert row
But I'd like to do it with a SQL command instead of programmaticly
Thanks for your Help
Daniel
I have a database and in one of the table I need to insert some data. This
data has a primary key. often in my input I receive the same data twice, the
insertion fail as it violate my constraint. This all work ok but I have two
problems:
- I need to handle the error when the insertion fail, so that I can ignore
the error
- The odbc driver is outputing to the error to the debug stream output
(outputDebugString)
In MS-SQL I could do:
IF (SELECT count(*) where key = '1') = 0 INSERT into mytable (col1, col2)
values(key, data).
this work fine with MS-SQL, but I cannot find how to do it with the JetDB.
for now I do:
a select with the proper where clause,
If no row returns
Insert row
But I'd like to do it with a SQL command instead of programmaticly
Thanks for your Help
Daniel