how to find unique records from 2 diff table in diff database
for example
1st database 1sttable 2nddatabase 2nd table
1st table has 14,15,16,17
2nd table has 13,14,15,16,17,18
so i want only 13 and 18 record
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jignesh TrivediPosted Jan 20, 2013, 11:25 PM
hi,
you can use following query if both database is in same server
select * from database1.dbo.table1 t1
where t1.Id not in(select Id from database2.dbo.table2 t2)
if your databases are not on same server then you must create link server between those database.
for creating link server please refer
http://msdn.microsoft.com/en-us/library/ff772782.aspx
http://www.c-sharpcorner.com/uploadfile/suthish_nair/linked-servers-in-sql-server-2008/
hope this will help you.