Using PHP to Copy an SQL Server Table to MySQL

At work, we have a scheduled task run every day that pulls information out of a huge Oracle database and dumps it into a Microsoft SQL table on one of our local IIS Web servers. We then have a script on our remote LAMPP Web server (the one we use to serve up our public Web site) that queries that MSSQL table and displays results on the Web site.

Unfortunately, because the Web server and the MSSQL server are in different locations, the results are sometimes slow and unreliable. For instance, if, for some reason, the network connection to our IIS server is down or if the IIS server itself is down, we can’t pull any data from the MSSQL table.

The other day, I began working on a script that will pull only the information we’ll need for any given day out of the MSSQL table and then create a new table in our MySQL installation that resides on the same server as our Web site.

Following are some good tips for you if you decide to do the same thing.