Created
February 4, 2010 15:19
-
-
Save treffynnon/294727 to your computer and use it in GitHub Desktop.
Convert MySQL tables to T-SQL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$conn = mysql_connect('host','user','pass'); | |
mysql_select_db('database',$conn); | |
$SQL = "SHOW TABLES;"; | |
$result = mysql_query($SQL, $conn); | |
while($row = mysql_fetch_array($result)) | |
print "SELECT * INTO SQLServerDBName.dbo.{$row[0]}<br /> | |
FROM openquery(MySQL, 'SELECT * FROM `{$row[0]}`');<br /> | |
"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment