SQL: compare two table record by record
问题 I want to compare two tables recordby record. I have two cursor for each table. The code looks like this Declare Cursor c1 for SELECT * from Table1 OPEN c1 While @@Fetch_status=0 Begin Declare Cursor c2 for SELECT * from Table2 OPEN c2 WHILE @@Fetch_Status=0 Begin /*Comparison happens here*/ END END When fecthing, must I specify which cursor I am fetching and how do I do that? EDIT For each record in Table1 I want to Search Table2 for that record based on the primary key. When it is found, I