Copy Database Structure From MS SQL 2005 to MySQL 5.1 - mysql

I want to Replicate a database without data (Only the structure) with stored procedures from MS Sql Server 2005 to My SQL 5.1. Is there an easy way of doing this.
I have Installed the MySQL Workbench 5.2

In SQL Server Management Studio you can right click on a database and go to Tasks->Generate Scripts...
Then you can basically go through generating the SQL queries that will work in MySQL
My first thought would be to not include any indexes, constraints or foreign key stuff in the queries, as MySQL handles these quite differently to SQL Server.
Just practice a few times and note down what causes errors when you use the queries in MySQL.
Using the knowledge of how MySQL handles your database objects you can try and create stored procedures that generate the queries that will create these objects on MySQL and then execute them against the MySQL database.
EDIT :
Ok so you want to move stored procedures over from SQL Server to MySQL. This is a fairly tricky thing to do if the stored procs are complicated.
Here is the basic overview I suggest you read before asking more specific questions about your problems.
http://dev.mysql.com/tech-resources/articles/migrating-from-microsoft.html
My advice is you read this and then try and migrate your stored procs and if you get errors, come back and ask specific questions about them.

Related

Oracle to MariaDB data migration

We are in the process of migrating a fairly large Oracle database (approx. 200 tables) to MariaDB. We used CA ERwin to help create the MariaDB schema objects, and are now trying to figure out the best way to migrate the data. For example, if I use SQL Developer's export utility, the resulting Insert statements are created with Oracle syntax, which can differ quite a bit from MariaDB's syntax. Rather than handling every set of Inserts on an individual basis, I'm hoping somebody has been through this before and can suggest an alternative.
We looked at the MySQL Workbench Migration Wizard, but it doesn't directly support migration from Oracle to MariaDB/MySQL (no surprise as Oracle owns MySQL).
Has anybody come across a utility that will make this task easier and save time? Thanks.

Migrate only Stored procedure from SQL Server to mysql automatically

When we migrate from SQL Server to mysql only table structure and data transfer, stored procedures, views and triggers don't transfer. Is there any why to transfer stored procedures and triggers using mysql migration help or any other tool? I'll be very thankful to help me. Why stored procedures and views do not transfer while I select both check boxes in ysql Workbench?:
The problem is that transferring database objects that contain code is not really straightforward and myqsl workbench does not transfer them automatically. See mysql workbench documentation on Migrating from supported databases:
Generally speaking, only table information and its data are automatically converted to MySQL. Code objects such as views, stored procedures, and triggers, are not. But supported RDBMS products will be retrieved and displayed in the wizard. You can then manually convert them, or save them for converting at a later time.
I agree, this should be made more clear in the user interface of mysql workbench. There are other migration tools that claim to be able to automatically migrate such objects between ms sql and mysql (recommending tools is out of scope, but with some google serach you will find them), but I have yet to see an application that can truly migrate complex code from one rdbms to another.

MSSQL TO MySQL database Migration

I need a working tool for migrate DDL objects and data tables from MS SQL Server to MySQL. I checkout Database Migration Wizard in MySQLWorkBench 6.3,i have also tested with Ispirer tool (not free) and i can migrate only tables and data in tables but not views, store procedures and functions (maybe trigger not)..
In this MySQLWorkbench tools page : https://dev.mysql.com/doc/workbench/en/wb-migration-overview.html i found
"d.View objects are copied, and commented out if the source is not MySQL.
e.Stored Procedure and Function objects are copied, and commented out if the source is not MySQL."
So, i'm confused about why copy them and comment-out and not try to convert syntax? we know that database source is MSSQL so the syntax is different from mysql? I think it's impossible write mysql objects in MSSQL Server..no?
Thanks
Roby
Yes, the syntax is different in MySQL. The conversion process is too complicated to do it automatically, however we gave the possibility to convert it manually. So if you want migrate those views/procedures, you must uncomment it and rewrite to MySQL compatible sql.

Query SQL Server database from MySql?

I am trying to find a work around to expedite our contractors work on our new website. The website is being created in WP using MySql, and some data that the website will dynamically load is located on our business SQL Server. Migration is out of the question.
Is there a way to query our SQL server from the MySql database?
Querying SQL server from MySQL database is not the good solution I think. Why not querying the SQL server using PHP for example?
The end result was that the workaround involved adding to an internal web app to populate the MySQL database with the data that we needed

How to export data from SQL Server 2005 to MySQL [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I've been banging my head against SQL Server 2005 trying to get a lot of data out. I've been given a database with nearly 300 tables in it and I need to turn this into a MySQL database. My first call was to use bcp but unfortunately it doesn't produce valid CSV - strings aren't encapsulated, so you can't deal with any row that has a string with a comma in it (or whatever you use as a delimiter) and I would still have to hand write all of the create table statements, as obviously CSV doesn't tell you anything about the data types.
What would be better is if there was some tool that could connect to both SQL Server and MySQL, then do a copy. You lose views, stored procedures, trigger, etc, but it isn't hard to copy a table that only uses base types from one DB to another... is it?
Does anybody know of such a tool? I don't mind how many assumptions it makes or what simplifications occur, as long as it supports integer, float, datetime and string. I have to do a lot of pruning, normalising, etc. anyway so I don't care about keeping keys, relationships or anything like that, but I need the initial set of data in fast!
The best way that I have found is the MySQL Migration Toolkit provided by MySQL. I have used it successfully for some large migration projects.
Using MSSQL Management Studio i've transitioned tables with the MySQL OLE DB. Right click on your database and go to "Tasks->Export Data" from there you can specify a MsSQL OLE DB source, the MySQL OLE DB source and create the column mappings between the two data sources.
You'll most likely want to setup the database and tables in advance on the MySQL destination (the export will want to create the tables automatically, but this often results in failure). You can quickly create the tables in MySQL using the "Tasks->Generate Scripts" by right clicking on the database. Once your creation scripts are generated you'll need to step through and search/replace for keywords and types that exist in MSSQL to MYSQL.
Of course you could also backup the database like normal and find a utility which will restore the MSSQL backup on MYSQL. I'm not sure if one exists however.
SQL Server 2005 "Standard", "Developer" and "Enterprise" editions have SSIS, which replaced DTS from SQL server 2000. SSIS has a built-in connection to its own DB, and you can find a connection that someone else has written for MySQL. Here is one example. Once you have your connections, you should be able to create an SSIS package that moves data between the two.
I ddin't have to move data from SQLServer to MySQL, but I imagine that once the MySQL connection is installed, it works the same as moving data between two SQLServer DBs, which is pretty straight forward.
Rolling your own PHP solution will certainly work though I'm not sure if there is a good way to automatically duplicate the schema from one DB to the other (maybe this was your question).
If you are just copying data, and/or you need custom code anyway to convert between modified schemas between the two DB's, I would recommend using PHP 5.2+ and the PDO libraries. You'll be able to connect using PDO ODBC (and use MSSQL drivers). I had a lot of problems getting large text fields and multi-byte characters from MSSQL into PHP using other libraries.
Another tool to try would be the SQLMaestro suite. It is a little tricky nailing down the precise tool, but they have a variety of tools, both free and for purchase that handle a wide variety of tasks for multiple database platforms. I'd suggest trying the Data Wizard tool first for MySQL, since I believe that will have the proper "import" tool you need.