How to migrate sqlserver data to the mysql database and precautions: sqlservermysql
During project development, sometimes the database used at the beginning of the project is SQL Server, and the stored database is changed to MySQL, so the data of SQL Server needs to be migrated to MySQL. The following is an SQL Server database migration method compiled daily by xiaobian.
I. The Common Data Types in SQL Server are different from those in MySQL.
Ii. Notes for migrating SQL Server data to MySQL
1. for different unique indexes, only one null value is allowed for the unique index field of SQL server, while multiple null values are allowed for all the fields corresponding to the unique index in oracle.
2. the syntax of a stored procedure is very different. Migration of a stored procedure is the most troublesome and needs to be modified carefully.
3. Some SQL statements written in the program must be modified according to different syntaxes.
Iii. Common Methods for migrating SQL Server data to MySQL
1. Use SQLyog for Migration
Advantages
This migration method is simple and flexible. during migration, you can modify fields. For example, in SQL server, it was originally datetime, and then you can configure it to timestamp when migrating data to mysql. The success rate is very high;
Disadvantages
Migration is slow! This is the biggest drawback of this method. If the table's data volume reaches several 100,000 rows or even millions of rows, you will find that the migration is really slow. It is much slower than other migration methods.
2. Use the script export function of powerdesigner and SQL server for Migration
(1) This method first uses powerdesigner to reverse engineer the SQL server database, get the E-R diagram, and then generate the MySQL table creation statement. Migrates the database structure. Of course, you can migrate the table structure without using powerdesigner. For example, I export the table structure to an idiom sentence, then manually modify it, and then run it in MySQL;
(2) Use the SQL server tool SSMS to export the table data in the SQL server database to an insert statement. Each table exports a file and then processes the file, and then import it to the MySQL database.
3. Use Oracle MySQL Server's official workbeach tool for Migration
(1) When using workbench to connect to SQL server, you must have the permission to view any database. Otherwise, workbench cannot access the table structure metadata of SQL server and thus cannot be migrated.
(2) There are also methods for using Navicat for migration. The method is similar to SQLyog.
I hope you will like the above SQL Server database migration method.