PH copy tables from MSSQL to MYSQL

Hi, I need php code to copy a table from MS SQL to MYSQL.
Jose BredariolPMPAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave BaldwinFixer of ProblemsCommented:
How are you currently accessing the MS SQL server?
Jose BredariolPMPAuthor Commented:
I´m not accessing it yet. MSSQL is on my windows server (2008R2) and there we use asp and .net. Now I want some tables on my new server linux debian with php. I´m accessing MYSQL using :

 mysql_connect($hostname, $username, $password) or die(mysql_error());
 mysql_select_db("DATABASENAME") or die(mysql_error());
Dave BaldwinFixer of ProblemsCommented:
You should write a program that runs on the Windows Server to fetch the data you need and send it to your Linux server.  To get the data from a PHP program on your Linux server can be difficult.  You would first have to make sure that TCP/IP and remote connections are enabled on your MS SQL server.  Then you would have to struggle thru setting up FreeTDS on Linux.  And even then you may find that FreeTDS does not support all of the data types that are available in SQL Server 2008 and newer.
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

Jose BredariolPMPAuthor Commented:
Yes,  TCP/IP and remote connections are enabled on your MS SQL server. I can´t do that on Linux using PHP ? Are you sure ?
Ahmed MerghaniSoftware EngineerCommented:
Hi Jose Bredariol,

No need to write code for this task and instead, you can use a ready tool!
I think this tool is what you asking about:
And there have a paper in how to do the migration:
Dave BaldwinFixer of ProblemsCommented:
It is just more difficult than it should be.  There is no current driver for MS SQL on Linux unless you are running RedHat Enterprise.  The asker explains in this question how he finally did it.  It does work and I have used his method.  But if you are using some of the newest data types in MS SQL, they will not be supported.  They also won't be a direct match to the data types available in MySQL.  Even Date/Time types are not exactly the same between the two systems.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jose BredariolPMPAuthor Commented:
Thanks all
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.