Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Link Server.
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Yak Posting Veteran

62 Posts

Posted - 10/10/2012 :  07:10:18  Show Profile  Reply with Quote
Hello Guys

We are currently Migrating from MYSQL to MSSQL.

I want to insert the Records from MYSQL to MSSQL but not all.

I only want to insert only the records that doesnt exist in MSSQL table.

How can I do that?

Is it possible to check all the data that exist in MYSQL and Doesnt Exist in MSSQL?

Please help me

Thank you

Flowing Fount of Yak Knowledge

5155 Posts

Posted - 10/10/2012 :  07:15:41  Show Profile  Reply with Quote
You can set up a linked server to MySql and use OPENQUERY to get the data, compare to what you already have and insert records that do not exist in MSSQL. This page has some information on how to set it up:

However, another approach, which may perhaps be easier and more predictable is to simply bring in ALL the data from MySQL into a staging table in MSSQL. Once you have it there, writing a query to pick only the rows that you need from the staging table and inserting into your target table is easy. To bring in all the data from MySQL, you can use SSIS, or even Import/Export Wizard in SQL Server. (right click on the database name in object explorer in SSMS and select Tasks -> Import Data
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000