Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

MSSQL to MySQL via perl

by dannoura (Pilgrim)
on May 12, 2009 at 13:47 UTC ( #763479=perlquestion: print w/replies, xml ) Need Help??
dannoura has asked for the wisdom of the Perl Monks concerning the following question:


I'm trying to import data from a MSSQL database to a MySQL database. It seems that some characters get mangled in the translation. When I print them out they come out as a question mark (they also appear that way in the MySQL DB). Basically, I just select from the MSSQL table and then go over the results with fetchrow_array and insert each row (using placeholders) into the MySQL table.

I saw a number of nodes referencing inserts into MSSQL, but none saying anything useful about selects. Anyone have any suggestions?

Replies are listed 'Best First'.
Re: MSSQL to MySQL via perl
by jfroebe (Parson) on May 12, 2009 at 14:02 UTC

    Hi there,

    Microsoft SQL Server and Sybase ASE/IQ/SQL Anywhere will replace unknown characters with a question mark when the default character set does not match the character set of the data being imported.

    Recommendation: extract the data out of you MySQL database in a delimited file (csv) using the utf8 (unicode) character set. Import into SQL Server using bcp specifying utf8 with "-Jutf8" parameter and character mode "-c".

    Jason L. Froebe

    Blog, Tech Blog

      It appears the OP wants to go MSSQL --> MySQL, not the other way round.

        Somehow I missed that :( The same rules apply: extract out and in with the same character set.

        Jason L. Froebe

        Blog, Tech Blog

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://763479]
Approved by ww
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2017-08-19 19:48 GMT
Find Nodes?
    Voting Booth?
    Who is your favorite scientist and why?

    Results (312 votes). Check out past polls.