Martin Gainty wrote:
> -- i usually
> INSERT the record
> --then check for PK VIOLATION e.g.
> IF PK_VIOLATION then UPDATE record
>
> is FoxPro still supported???
My understanding is that exception handling carries significant overhead and so
doing it within a heavy-iterated loop like this import would perform badly.
Partly for that reason and partly for code readability, I would recommend
instead the suggestion of copy the whole source to a staging table with COPY and
then use a single SQL statement to reconcile/integrate that staging table with
the main table.
In particular, I like the staging table approach because the single SQL
statement afterwards is a concise declarational code saying what you actually
want to do, relative to a client-interfacing loop which is a more verbose
imperative version.
-- Darren Duncan