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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Comparing 2 tables row by row without cursors

Author  Topic 

munishw
Starting Member

4 Posts

Posted - 2007-05-22 : 02:02:43
Hi,

I want to compare 2 tables row by row but without the use of cursors.

Loop
Table A.Col1
Compare to Table B.Col1
If Matched Break
End

I have tried couple of things like using min and currentid logic
but cant achieve what I want.

Requesting if somebody guide me to the right way.

Thanks.


harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-05-22 : 02:06:06
If you are doing this in SQL 2005, you can simply use EXCEPT operator.



Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-05-22 : 02:34:36
or try
http://weblogs.sqlteam.com/jeffs/archive/2004/11/10/2737.aspx

Madhivanan

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

- Advertisement -