SQL Server data import MySQL

Source: Internet
Author: User
Tags table name mysql database

In the work encountered SQL Server data import MySQL problem, on the Internet to check the relevant information, useful MYSQLODBC also useful other software import, all need to install the relevant plug-ins. My problem is only a table in the database import, do not need the entire database transplant, so do not want to so troublesome, so I tried the data format conversion mode, oh, fortunately, the problem is solved, but also quite simple, take to share with you.

Basic principles SQL Server Datasheet--->csv file----> import MySQL database.

Implementation steps:

1. Open SQL Server Enterprise Manager, select the table to be transplanted in the database, right-click to select "All Tasks"---"Export data", follow the prompts to click Next, the data source do not make changes click Next, Purpose: Dropdown box select "Text File", Click on the file name of the text box after the button to select the location to save the file, and give a name to the file to be exported, we may give it a temporary name called "1.csv" (remember that the suffix must be written in CSV format, otherwise MySQL can not import), and then click Next, follow the prompts to click a step, In the Select destination file format interface, in the Source: Drop-down box to select the data table to export, here must be careful, otherwise you will export the table is not the data table you want, select the next step, next, complete. The procedure for converting a SQL Server datasheet to a CSV file is finished.

2, this time the exported CSV file can not directly import MySQL, because the data does not have a header, you need to modify. In SQL Server Enterprise Manager, you can select the table you just exported by clicking the right mouse button and selecting "Design Table"

Copy the information, such as column name, data type, length, to the paper. Then use Notepad to open the exported CSV file, hit the first line, the first line of empty, fill in the name of the column just copied down, the format is as follows: "Ncid", "NCName", "link" (Datasheet column name in quotation marks, Separated by commas, and then saved, the CSV file was modified. Then build a directory named 1 on the desktop, and place the CSV file in that directory.

3, the use of SQLyog will be MySQL open, select the database to import, if not built in advance, click the right button to select Import (Import), select the "Import External Data Wizard" option, click Next, Select a CSV in the data source type item. In the selection directory to find the table just built 1 of the directory, click Next, according to the prompts have been clicked to complete, refresh the datasheet, so that in MySQL imported a named 1_csv datasheet, the data table name to make a change, You can also adjust the data type and data length of the datasheet and the index key if necessary (these steps can be implemented by SQLyog modify the datasheet function), and the datasheet import work is done.

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.