MySQL5.7 transfer data to SQL Server Comments

This link: https: //blog.csdn.net/qq_37308779/article/details/80679358
a. Install MySQL ODBC driver
installed Connector for the MySQL / ODBC driver. One thing to note here is the version of Connector / ODBC driver corresponding problem with MySQL Server.

 

 

 

two. Create a System DSN
DSN for the ODBC defines the database and ODBC drivers must use a certain. Each ODBC driver defines a database driver support for creating DSN needed.
Create a system DSN following steps:
Start -> Settings -> Control Panel -> Administrative Tools -> Data Source (ODBC), by opening the flow manager ODBC data source.
Switch to System DSN tab, click the Add button. Create New Data Source pop-up dialog box, select the MySQL ODBC 5.3 Unicode Driver Driver (depending on the version, the name may differ), click the Done button.

 


In the pop-up dialog box to set the link MySQL MySQL database account information.

 

 

 

 


The key is the number of parameters in the Login tab.
l Data Source Name, according to this naming any names on it, eventually will be displayed in the list under the ODBC Data Source Administrator System DSN tab.
l Description, for a description of the data source, not fill.
l Server, MySQL Server's host name, here to fill the computer host name or localhost can be.
l User and Password is the MySQL Server corresponding user name and password.
l DataBase, the data source is directed selected database. In this must be requested in the first few parameters are correct, otherwise it will prompt an error, you can not select the MySQL Server database.
Note that there are two parameters are the Port and Character Set in the Connect Options tab. Port used to set the communication port MySQL Server, the default is 3306, if not change the default port during installation time, there may not be provided. Character Set coding language used to set up the database, select here gbk.
Click the OK button to complete the creation of a System DSN, return to the ODBC Data Source Administrator dialog box, under the System DSN tab to view the newly created data source. Click the OK button to exit.

three. Creating MSSQL to MySQL link service
open SQL Server Management Studio, run the following statement, establishment and MySQL Server linked server through the front of the new ODBC data source.

Master.dbo.sp_addlinkedserver EXEC
@server = N'MYSQL ',
@ = N'MySQL srvproduct',
@ = N'MSDASQL Provider ',
@ provstr = 5.3 N'DRIVER = {the MySQL the ANSI the ODBC Driver}; SERVER = 127.0.0.1 ; _
DATABASE = News; the USER = the root; PASSWORD = 13579; the OPTION =. 3 '
. 1
2
. 3
. 4
. 5
. 6
-refresh server node links, both can be seen by the above statement creates links

 

 


four. Transfer data using the SQL statement to MSSQL
created in Microsoft SQL Server in a new database, run the following statement be run after the MySQL database "news" into Microsoft SQL database "news" in.

SELECT * INTO .dbo database table
the FROM the OPENQUERY (MySQL, 'SELECT * from the database table.')
. 1
2
Example: introducing MySQL database "news" in the article table into the "news" SQL Server database article in

SELECT * INTO [news].dbo.article
FROM openquery(MYSQL, 'SELECT * FROM news.article')

 

 


Results of the

----------------
Disclaimer: This article is CSDN blogger "one or only" original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source and link this statement.
Original link: https: //blog.csdn.net/qq_37308779/article/details/80679358

Guess you like

Origin www.cnblogs.com/gzhbk/p/11648613.html
Recommended