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.
| Author |
Topic |
|
gangadhara.ms
Aged Yak Warrior
549 Posts |
Posted - 2009-11-26 : 05:55:17
|
| Dear All,I have a 2 sql Server i need to find out the the invoice number which are present in one server and not in another server.Here is the query select distinct T1."snp_Invoice_Number" "c1" from "AR_Snapshot" T1 where T1."snp_Post_Period_EOM" >= {ts '2006-01-31 00:00:00.000'}I have the same schema in both the server.please help me to write a query for this |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-11-26 : 07:20:02
|
| is there any linked server bw the serverthen u can do it--1select distinct T1.snp_Invoice_Number c1from firstserver.schema.AR_Snapshot T1left join secondserver.schema.AR_Snapshot T2 on t2.snp_Invoice_Number = t1.snp_Invoice_Numberwhere t2.snp_Invoice_Number null----2select *from firstserver.schema.AR_Snapshot where snp_Invoice_Number not in (select snp_Invoice_Number from secondserver.schema.AR_Snapshot)--3select *from firstserver.schema.AR_Snapshot t where NOT EXISTS (select * from secondserver.schema.AR_Snapshot WHERE snp_Invoice_Number = t.snp_Invoice_Number) |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-11-27 : 02:30:40
|
quote: Originally posted by gangadhara.ms Dear All,I have a 2 sql Server i need to find out the the invoice number which are present in one server and not in another server.Here is the query select distinct T1."snp_Invoice_Number" "c1" from "AR_Snapshot" T1 where T1."snp_Post_Period_EOM" >= {ts '2006-01-31 00:00:00.000'}I have the same schema in both the server.please help me to write a query for this
you can use SSIS for this. what you need is thishttp://www.sqlis.com/post/Get-all-from-Table-A-that-isnt-in-Table-B.aspx |
 |
|
|
|
|
|