Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Convert MS SQL .sql files for use with MySQL

Posted on 2010-08-31
4
Medium Priority
?
467 Views
Last Modified: 2012-05-10
I'm using MySQL 5, I have several .sql files for building tables that were generated by MS SQL, is there any easy way to convert them so that I can use them with MySQL?
0
Comment
Question by:Bang-O-Matic
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 2

Accepted Solution

by:
bogdan_iuly earned 1000 total points
ID: 33568938
Hello,

If you don't have many tables, you can do the following (in Notepad)::
- replace bit with tinyint or what other type of field you want to use
- replace [ with empty string
- replace ] with empty string
- replace dbo. with empty string
- replace ON [PRIMARY] with empty string

Now:
- manually  delete the code after the constraint, which is in my case:
WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]

I hope this helps a little.

Thank you

What you start up with:

CREATE TABLE [dbo].[TEST](
	[TESTFLD] [varchar](255) NOT NULL,
	[TESTBIT] [bit] NOT NULL,
 CONSTRAINT [PK_TEST] PRIMARY KEY CLUSTERED 
(
	[TESTFLD] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]







What you end up with:

CREATE TABLE TEST(
	TESTFLD varchar(255) NOT NULL,
	TESTBIT tinyint NOT NULL,
 CONSTRAINT PK_TEST PRIMARY KEY CLUSTERED 
(
	TESTFLD ASC
)
)

Open in new window

0
 

Author Comment

by:Bang-O-Matic
ID: 33569402
Thanks for the help, I have several large tables to build, I am more looking for a possible software solution? maybe something that will re-write these files to make them MySQL compliant.
0
 
LVL 35

Assisted Solution

by:ste5an
ste5an earned 1000 total points
ID: 33576602
Build your database on a SQL Server (Express) instance and use MSSQL2MYSQL:

  http://dev.mysql.com/tech-resources/articles/migrating-from-microsoft.html

Or use the MySQL Migration Toolkit:

  http://dev.mysql.com/downloads/gui-tools/5.0.html


mfG
--> stefan <--
0
 

Author Closing Comment

by:Bang-O-Matic
ID: 33577801
Thanks!
0

Featured Post

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
In this article, we’ll look at how to deploy ProxySQL.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question