views:

19

answers:

1

if you are running a query that inserts a new set of records in a table from other one, there is a way to force the update of the coincident pk record in the destination table, without deleting records or split the process in two others (insert new and update existing)?

+1  A: 

In Firebird 2.1, you can do Update or Insert

UPDATE OR INSERT INTO T1 (F1, F2)
    VALUES (:F1, :F2)
    MATCHING (F1);
Hugues Van Landeghem
Sorry, i'll be more objective:
darth_alexious
I receive a large txt file containing csv non normalized data everyday. This file contains new and updated data, wich with I insert/update a database. I must to update the records referent data already existing and insert the new ones. Example: I must delete yesterday's records, reinsert the updated values for them and insert the today's new records, from same txt file. I wonder if would be a way to do this two operations in a single step, like eg. forcing the update of the data if occours pk constraint violation. If we don't have a sql/built-in way, maybe a stored procedure can do it...?
darth_alexious
The link I send you explain how to do this : I understand finally well
Hugues Van Landeghem