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
 General SQL Server Forums
 New to SQL Server Programming
 finding discrepancies between 2 tables

Author  Topic 

AdamWest
Constraint Violating Yak Guru

360 Posts

Posted - 2011-07-13 : 20:37:34
I have some data from one server call it Server A. it is all one column of Docnumber. Server A is using Mysql. it does not have a text. option for result set export.
I have to copy this over to a different server - Server B, which is using SQL Server 2008 and then compare against a table that has a docnumber although it's called invoicenum (but is same thing).
The purpose is to see the invoicenum's that are NOT on the first table.
2 issues I face.
1. how to get the column from Server A to a table in Server B. It's 9000 rows, I don't mind copy/paste but I believe there is a better way.
2. once that is done, how to compare the 2 and
produce a list of those invoicenum's that are NOT on server A.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-07-13 : 20:52:35
create a linked server to MySQL http://www.packtpub.com/article/mysql-linked-server-on-sql-server-2008

to find invoicenum not exists in A

select invoicenum
from ServerB_table b
where not exists
(
select *
from ServerA_Table a
where a.docnumber = b.invoicenum
)



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -