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

From: Michaele James <mjames_at_jsifrs.com>
Date: 1996/03/28
Message-ID: <315A98C9.4C94_at_jsifrs.com>#1/1


Andy MArr 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 ? .
>
> Any help would be great
>
> Regards
> Andy Marr.

Here is what I have done in SQLSERVER, it is very fast. I hope it helps with your problem. The # indicates a temporary table.

SELECT coreid, giftid
INTO #nocore22
FROM corebio, transact
WHERE giftid *= coreid
SELECT COUNT(*)
FROM #nocore22
WHERE coreid = null
DROP table #nocore22 Received on Thu Mar 28 1996 - 00:00:00 CET

Original text of this message