Posted by Erland Sommarskog on 06/30/06 21:51
rhaazy (rhaazy@gmail.com) writes:
> ah ahaha all I needed to do was this...
> use my normal insert statement and add a where clause to the end of it
> like this..
>
> UpdateTblScanDetail....
>
> Insert into TblScanDetail
> where #temp.ID not in (select GUIID from tblScanDetail)
>
> doh! way too simple....
So, you issue is resolved then, and I don't have to scrutinize your
earlier posts.
Just a comment. I prefer to write the condition as:
NOT EXISTS (SELECT *
FROM tblScanDetail SD
WHERE SD.GUIID = #temp.ID)
There are two problems with NOT IN, that NOT EXISTS does not have:
1) you can get lost when there are NULL values involved.
2) works only with one-column conditions.
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
[Back to original message]
|