How to import data from MySQL to SQL Server

Source: Internet
Author: User
Tags management studio microsoft sql server management studio sql server management sql server management studio

This article discusses how to import a MySQL database into SQL Server, so first you need to install both databases, and then follow the steps below.

I. Installing ODBC Drivers for MySQL

1. Download MySQL ODBC Connector, Download:/http/dev.mysql.com/downloads/connector

2. From the Control Panel-Admin tool, open your data source (ODBC), select System DNS, point Add.

 

3. In the Create New Data Source dialog box, select MySQL ODBC 5.1 Driver, click Finish.

4. After the completion of the MySQL Link dialog box, add your MySQL database account information, and confirm that the "root" account has all the permissions, if you install MySQL is not modified, do not change the port number 3306.

5. Click the "Test" button to confirm that your link is correct.

Press the "Test" button to ensure your connection settings is set properly and then the "OK" button when you ' re done.

Two. Create a Microsoft SQL to MySQL link

1. In SQL Server Management Studio, open a new query, copy the statement, modify the name of your database, and run it.

EXEC Master.dbo.sp_addlinkedserver
@server = N ' MYSQL ',
@srvproduct =n ' MySQL ',
@provider =n ' Msdasql ',
@provstr =n ' driver={mysql ODBC 5.1 DRIVER}; Server=localhost; _
Database=tigerdb; User=root; Password=hejsan; Option=3 '

2. This script creates a join to your MySQL database via the ODBC driver, which appears in Microsoft SQL Server Management Studio such as:

If this diagram does not appear, it will be refreshed.

Three. Guide data between two databases

Create a new database in Microsoft SQL Server (for example:testmysql), copy the following statement in new query, and then run the MySQL database " tigerdb” 导入到 Microsoft SQL 数据库“testMySQl”中。    

SELECT * into TestMySQL.dbo.shoutbox

From OPENQUERY (MYSQL, ' SELECT * from Tigerdb.shoutbox ')

These are all the steps.

This digest from: http://blog.csdn.net/caijing3210/article/details/7238953

Thanks to the author for guidance.

How to import data from MySQL to SQL Server

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.