Introduction to SQL Server data import to MySQL database (1)

Source: Internet
Author: User

The first method is to install mysql ODBC and use the export function of SQL server to select the mysql data source for direct data export. This method is simple, but there are many drawbacks for practical applications, the most important manifestation is the data type problem. First, ntext, image, and other data types in the SQL server database cannot be directly written into the mysql database. It is said that only a slight change is required, unfortunately, this cainiao did not think about how to change it. Secondly, because I set the time in the mysql database design to the int type (the timestamp is saved), after the data is imported, conflicts will occur. Again, the field type of the mysql DATA table generated by this method is not suitable, so this method is not recommended.

The second method is to use php or asp scripts to import data. This method requires programming, but it is flexible and difficult to operate. Everything is under your control, this method is briefly introduced. The precondition is that your mysql environment has been set up. First, you have created the target database and then generated all the table structures using SQL statements. Now everything is ready, and only data is missing.

You can use the following php script to import data from the user table of mydb database in SQL server to mydb database in mysql:

 
     

Save the script as SQL. php and execute it on the server to import the data in the user table of mydb database in SQL server to the user table of mydb database in mysql. The operations on other tables are the same as those in other tables.


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.