0

I have a procedure, say "proc1", inside a MS-SQL server. I would like to create a table (copy of proc1) inside a MySQL server.

So far what I do is this:

1-Create a connection to MS-SQL Server
2- run the code $sql = "exec [procedureName] '$param' ";
3-Traverse all 500.000 lines.
4-Store all lines inside a php variable (had to set ini_set('memory_limit','1024M');).
5-Close the connection.
6-Store the data inside a file.
7-Create a table inside a Mysql server, says MySQL_tbl1.
8-Traverse the file, line by line, Sanitize each field -> escape special character and insert inside MySQL_tl1.
Note: I've tried some variations like insert in one shoot. It improve my code only in 10 seconds.

If I was dealing with a MySQL table to generate another table inside MySQL I could use INSERT INTO ... SELECT. . I think this could be the faster way to create a new table inside the MySQL server. But I am dealing MS-SQL to MySQL. So my question is that: Is it possible to use INSERT INTO ... SELECT in this situation? If yes, how?

Just add a note: I would like to do this using code => (php+Mysql)

5
  • You could check the instructions at this site: mysqlworkbench.org/2012/07/…
    – RLF
    Feb 2, 2016 at 19:33
  • Hi RFL, so that means we can do this using code?
    – IgorAlves
    Feb 2, 2016 at 20:29
  • 1
    You can do this using code, ETL tools, copy to csv using native tools. It's certainly possible, You are not the first person ever attempting this so google should be of help.
    – Tom V
    Feb 2, 2016 at 20:32
  • Why do you want to use (php-MySQL)? If there is a process you can use successfully, just use it.
    – RLF
    Feb 3, 2016 at 0:16
  • Workbench replaces most of the code in your 8-step list.
    – Rick James
    Feb 3, 2016 at 0:40

1 Answer 1

1

The answer is simple... MySQL WorkBench! Enables migrations from the following systems.

SQL Server, Access, PostgreSQL, SyBase, etc... Manage migration projects Source & Target selection Object migration Version upgrades

Here's the link... http://www.mysql.com/products/workbench/migrate/

Price is good too! ;-)

-Tony

Not the answer you're looking for? Browse other questions tagged or ask your own question.