dannoura has asked for the wisdom of the Perl Monks concerning the following question:

hi,

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