Skip to main content
1 of 2
Jon49
  • 387
  • 3
  • 12

In retrospect it is probably nicer to just role my own converter since MySQL uses snake case instead of title case like SQL Server.

So, what I'm going to do is use a PowerShell script like so:

$tables = "FirstTable", "SecondTable"
function script {
    param(
        [System.String] $table
    )
    "set nocount on; select * from dbo."+$table
}

$tables |
% {
   $path = "C:\Data\"+$_+".txt"
   $script = script $_
   sqlcmd -S MyServer -d MyDatabase -W -h -1 -E -Q $script -s `"`t`" -o $path
}

This will export all the data from my SQL Server database and put them in files and then I will import those files into MySQL. Which I haven't quite figured out yet. I let the MySQL Workbench do the initial CREATE TABLE statements and used Vim to make everything snake case.

Jon49
  • 387
  • 3
  • 12