Link to home
Start Free TrialLog in
Avatar of Lev Seltzer
Lev SeltzerFlag for Israel

asked on

Need help migrating MSSQL database to MySQL

I am trying to migrate a MSSQL database to MySQL. I tried the migrate feature of MySQL Workbench, but it does not work. Even though the connection to MSSQL tested without a problem, the migration program does not find any schemas to import.

I then created a SQL file using SQL Server Management Studio and tried to import it using myphpadmin. It also failed, even though the compatibility was set to mssql.

Can someone help me move this database? I don't care how. Either to help me figure out what is going wrong with the above two methods, or introduce a third method.

Thank you.
Avatar of PortletPaul
PortletPaul
Flag of Australia image

I have never had to do this myself, but having been on the periphery of several dbms platform shifts my observation is "you get what you pay for" and attempting it without decent tools is very expensive in effort.

There do seem to be low priced tools around (e.g. https://dbconvert.com/mssql/mysql/  or http://www.convert-in.com/mss2sql.htm ) these may have trial periods (usually only converting a few rows per table) but these are data only conversions I believe.

If you are also looking to convert triggers, procedures, functions etc. then that's quite another story.
Avatar of Lev Seltzer

ASKER

Neither conversion program is finding my tables in the database. I have, unfortunately, two different schemas. At best they find the DBO schema. But I have tables with another schema (don't ask why - I barely understand how schemas work and do not remember creating a schema when I created the database 4 years ago).
To migrate from SQL Server to MySQL, MySQL offers MySQL WorkBench to do the basic needs..
You can get the MySQL WorkBench Community edition or other edition and start with your Migration activities.
https://www.mysql.com/products/workbench/features.html

>> Even though the connection to MSSQL tested without a problem, the migration program does not find any schemas to import.

I doubt this has something to do with the login you are using.. Check whether the login you are using to connect to MSSQL has privileges to export data..

>> Neither conversion program is finding my tables in the database. I have, unfortunately, two different schemas.

This confirms again that MSSQL login you are using doesn't have sufficient privileges.. Try with some other login with dbowner or sysadmin privileges to check once..
Technicians at the data center say MySQL Workbench is buggy when importing data.

I created a SQL file from MSSQL Server Management Studio, and then stripped it down to just to INSERT statements. When I try to import using PHPmyADMIN it fails, even though I set it to MSSQL compatibility mode.

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SERT [keterhat_admin].[QA] ([QuestionID], [Question], [Answer], [Siman], [Sif], ' at line 1

I don't have control over the logins - I can't give myself more permissions than I currently have, so if it is a permissions problem, I cannot solve it that way.

Is there some EASY way to take 4000+ insert statements designed for MSSQL and use them to insert data into a MySQL database?

Thank you.
May I know the some format of the INSERT statements generated inside your script..
If it is like the below, then it has a limit of 1000 values only and you might get some errors..
INSERT INTO #test(ID, Value)
VALUES (1, 'First'), (2, 'Second'), (3, 'Third');

Open in new window

Kindly confirm..
This is the code for one of the inserts.

INSERT [keterhat_admin].[QA] ([QuestionID], [Question], [Answer], [Siman], [Sif], [MB], [OtherSource], [TestID], [TimeStamp], [FinalTestNumber], [QuestionNum], [EditedQuestion], [EditedAnswer], [TestNum]) VALUES (1, N'<p>If a person wakes up in the morning with ...</p>', N'<p>A person that is in great need...</p>
', 1, NULL, 2, NULL, 1, CAST(N'2014-12-16T00:00:00.000' AS DateTime), NULL, 1, NULL, NULL, 1)

Open in new window


It was created using MSSQL SMS. If there is a better way to create the INSERT statements from the MSSQL file, I can do that. I just need them to work in MySQL.
Also, if I had to issue 5 queries to get all 4000+ questions into place, I could do that - it would not be such a terrible solution.
ASKER CERTIFIED SOLUTION
Avatar of Raja Jegan R
Raja Jegan R
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you for all your help. In the end, I just bought a program for $50 which did the conversion for me. While it didn't go as smoothly as I wanted, after 20 minutes I had completed the conversion, and I also now have a program that can be used again in the future.
Thanks for the update..
Kindly mention the program so that it would be helpful for others..
In this case I bought MSSQL to MySQL conversion wizard from Intelligent Converters http://www.convert-in.com/.
DBconvert was an alternative, but it was three times the price. For my needs, this was too expensive and the program I bought accomplished the task.