Migrate only Stored procedure from SQL Server to mysql automatically - mysql

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.

Related

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.

Move data from MS SQL to MySQL

I have one MS SQL DB (very big) and MySQL. I must move data from MS SQL DB to MySQL by doing SQL. It mean that source data & destination data arenot same structure. When source data is updated, the updating is reflected into destionation. Please give me an advice which is the suitable way?
Using SSIS
Using store procedure & write my own script
Other way.
Any advice is highly appreciated.
Cleanest way will be using stored procedures since it is not a complete immigration. By doing this you will have everything under control. MSSQL has a nice feature linked servers, a bit slow but worths it in most of cases. You can find instructions here: http://www.sqlservercentral.com/Forums/Topic340912-146-1.aspx
An example:
UPDATE your_mysql_database.dbo.your_mysql_table SET col1=...
To migrate from MSSQL to MYSQL, Please use MYSQL Migration Toolkit
To download and use the MYSQL Migration Toolkit, Please use the following link http://dev.mysql.com/downloads/gui-tools/5.0.html
The MySQL Workbench Migration Wizard is designed to save DBA and developer time by providing visual, point and click ease of use around all phases of configuring and managing a complex migration process:
Database migrations - enables migrations from Microsoft SQL Server, PostgreSQL, Sybase ASE, Sybase SQL Anywhere, SQLite, and more.
Migration project management - allows migrations to be configured, copied, edited, executed and scheduled.
Source and Target selection - allows users to define specific data sources and to analyze source data in advance of the migration.
Object migration - allows users to select objects to migrate, assign source to target mappings where needed, edit migration scripts and create the target schema.
Data migration - allows users to map source and target data and data types, set up data transfer and assign post data transfer events where needed.
Version Upgrades - using migration users can easily move databases off older MySQL versions to the latest.

Importing .sql into MS Access using OBDC

I currently have a database in MySQL, which I'd like to import in MS Access.
Is it possible to do this while keeping all relationships intact (i.e. without exporting to .csv, or by using ODBC)?
I'm a noob in this area so any help is greatly appreciated.
Thanks.
You need to solve two different problems:
Creating an empty MS Access database with a structure that matches the MySQL database structure.
Extracting the data from MySQL and loading it into MS Access.
This is not easy because different SQL databases offer different structural features, different datatypes, and so on. The more complex your use of MySQL is the more likely you'll run into some show-stopper during the conversion (for instance, Access doesn't support triggers at all). Conversely if you're using MySQL as a simple data store you may find the conversion fairly easy.
To get an MS Access database with the same structure as your MySQL database, your best bet is to find a database definition / diagramming tool that offers reverse engineering and supports both MySQL and MS Access. Use it to reverse engineer your MySQL database into a database diagram, then change the underlying database to MS Access and use the tool to generate a database.
Check out Dezign For Databases which (on paper, anyway) offers the features you would need to do this.
To pump the data across, there are any number of tools. This kind of operation is generically referred to as ETL (Extract, Translate, Load).
Do you mean SQL Server? A good starting point might be to check out SQL Server Integration Services (SSIS), which can be used for transferring data around like that.
Google will also be helpful, check out the first result:
http://support.microsoft.com/kb/237980
By the way, you said ".sql" in your question: a .SQL file is a script file, which could do anything from create a database, insert data, drop table, delete data, or given the right permissions, call system procedures and reboot a machine, format a drive, send an email.. Just for ref, .SQL files aren't the storage format used by SQL Server.
While you can script your database's schema into script files via something like SQLyog, you will find that the syntax varies enough from database to database (MySQL to Access, in your case) that you can't directly apply the scripts.
With much effort a conversion script could be created by editing the script (perhaps automated with a program, depending on the resulting script size). I think you would be better served using ODBC to copy the tables (and data) and then extracting and re-applying the relationships from the generated script by hand. Time consuming, but also a one time operation I would hope.
When both systems are the same database, there are tools that can do the comparison and script generation (TOAD for MySQL and RedGate Compare for Microsoft SQL), but they don't do cross database work (at least not the ones I am aware of).
If you create a ODBC DSN, you can use TransferDatabase to import from your MySQL database. You can do it manually with the GET EXTERNAL DATA command (or whatever it is in A2007/A2010) and see how well it works. It won't get all data types exactly right, but you could do some massaging and likely get it closer to what will work best.
Is there some reason you can't just link to the MySQL tables and use them directly? That is, why do you need to import into Access at all?
Access: run query. Just make sure to adapt the SQL code since every RDMS has its own sintaxis (despite SQL being an ANSI standard).

Copy Database Structure From MS SQL 2005 to MySQL 5.1

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.

Migrating schema and SP from informix to mysql

We need to redo a database in MySQL that has been already done on Informix, is there a way to migrate not only the schema, but the stored procedures as well?
Thanks.
We have a client whom we built a web application that uses an Informix database. Now the client wants to be able to implement the same software but on multiple closed networks (like 20). Doing this using Informix would be very expensive (20 licences X_X).
So the best approach is to redo the database on something like MySQL.
The application was done using Flex, .Net (using ODBC) and Informix.
I have done a similar thing, but I migrated Informix database to PostgreSQL. At first I dbexported the whole database, so the whole data and schema info was in text. Then I wrote some Python programs that translated schema, for example Informix DATETIME YEAR TO SECOND must be converted to timestamp with time zone.
When all CREATE TABLE/INDEX etc worked then I translated .unl files to PostgreSQL COPY commands. You should search how to do bulk load in MySQL, or convert those files to INSERT commands.
After that I started converting stored procedures. While PostgreSQL PL/pgSQL and Informix SPL are very different this part was the hardest and I was able to automatically convert only function "prototypes". Functions body had to be converted manually.
If you completed this you will have to check if your application work well with a new SQL implementation.