SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

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

Gerald30
Yak Posting Veteran

Philippines
52 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

sunitabeck
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: http://www.sqlservercentral.com/articles/MySQL/88366/

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  
 New 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.06 seconds. Powered By: Snitz Forums 2000