September 28, 2006 at 12:37 am
Good day all,
I need to join 2 tables from different servers to compare a column. The column is called accpaccode, and exists in both tables. What i need to know is how to compare the data in a way that will match the accpaccode in table CustomerBranch to table tbCustBranch, and return the values that exist in CustomerBranch but not in tbCustBranch.
Thanks!
September 28, 2006 at 12:49 am
September 28, 2006 at 12:53 am
Ganesh, thanks a stack! This is exactly what I needed!
September 28, 2006 at 1:28 pm
Or use an ANSI OUTER JOIN:
SELECT A.*
FROM CUSTOMERBRANCH A
LEFT JOIN [SERVER].[DATABASE].DBO.TBCUSTBRANCH B
ON A.ACCPACCODE = B.ACCPACCODE
WHERE B.ACCPACCODE IS NULL
September 28, 2006 at 2:18 pm
Only one point:
remote query will copy the whole remote table to local server. No use of index, no way for optimiser to do its job.
So, on big tables this query will be really sloooow.
_____________
Code for TallyGenerator
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply