Subject | Adding records |
---|---|
Author | drstanl |
Post date | 2004-01-24T19:28:25Z |
This is more along the lines of a "SQL for Dummies" question, but
since I'm evaluting Firebird and IBObjects, well, here goes...
I have created a 17 million record table. Now I want to perform
occasional updates. I'll be reading several thousand records from a
text file. Some of these records will be new to the database (i.e.,
new Primary Key), while others will be updates (existing PK).
Must I know in advance (of posting the record) which kind it is, and
then use INSERT or UPDATE accordingly, or is there a way to tell Fb
to either update or insert, depending upon whether it finds the PK?
If I must determine first whether the PK exists, what method would be
best (for efficiency). Should I perform an INSERT and trap for
errors, or do a query for that PK and (somehow) save the cursor so
that the resulting UPDATE need not perform essentially another
search? (That last part wasn't expressed very clearly.)
Thanks in advance,
-- Stan
since I'm evaluting Firebird and IBObjects, well, here goes...
I have created a 17 million record table. Now I want to perform
occasional updates. I'll be reading several thousand records from a
text file. Some of these records will be new to the database (i.e.,
new Primary Key), while others will be updates (existing PK).
Must I know in advance (of posting the record) which kind it is, and
then use INSERT or UPDATE accordingly, or is there a way to tell Fb
to either update or insert, depending upon whether it finds the PK?
If I must determine first whether the PK exists, what method would be
best (for efficiency). Should I perform an INSERT and trap for
errors, or do a query for that PK and (somehow) save the cursor so
that the resulting UPDATE need not perform essentially another
search? (That last part wasn't expressed very clearly.)
Thanks in advance,
-- Stan