Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SUBSTUTUTE FOR NOT IN

Author  Topic 

Limuh
Yak Posting Veteran

94 Posts

Posted - 2008-02-13 : 03:05:37
Im comparing two tables #T1 and #T2 and i want to insert data to other table #O1 if the data in table #T1 NOT IN table #T2 it loads to table #O1. I was advised not to use NOT IN Statement.If i query using NOT IN it returns multiple same datas in rows.

Please Help..

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-02-13 : 03:23:58
INSERT #O1
SELECT fields
FROM #T1 t1
LEFT OUTER JOIN #T2 t2
ON t2.linkfield=t1.linkfield
WHERE t2.linkfield IS NULL
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-02-13 : 03:51:21
or use not exists

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Limuh
Yak Posting Veteran

94 Posts

Posted - 2008-02-19 : 03:04:17
thanks
Go to Top of Page
   

- Advertisement -