Re: Help :- testing if values are not in a table

From: Tony Damon <bfntd_at_aimnet.com>
Date: 1996/03/29
Message-ID: <4jhh06$454_at_news.aimnet.com>#1/1


Andy MArr (andy_at_pindar.com) wrote:
: I've got a text file of ID type values which need to be compared agains
: the primary key of a main table with the same type of ID values.
:
: I plan to import these values in to a one field temporay table ( aprrox
: 2000 ).
:
: What I want to know is, whats the best(fast) way to check which values
: in the temporay table are NOT in the main table. Basically I want to
: list the values from the import file which are not in the database.
:
: I can only think of an individual select for each value or a WHERE NOT
: EXISTS type clause. Which would be the fastest ? , are there any other
: clever ways ? .

How about -

  1. Create temp table with a foreign key to the main table
  2. Use SQLLOADer (with replace option and BADfile specified) to attempt to load data to the temp table. Those values that are not in the main table will be rejected (constraint violation) and will be placed in the BAD file.

I've read other workable solutions to your post, so I offer this FWIW only.

Tony Damon Received on Fri Mar 29 1996 - 00:00:00 CET

Original text of this message