Hi Schalk -

Having just done this, it was not too hard.

We used Ruby on Rails (RoR) to create a schema file from the MSSQL database,
in order to recreate it in MySQL.  If your database is simple enough and/or
you have all the SQL used to create tables views etc., you don't need to do
this.

Make sure the tables created in MySQL have the columns in the same order as
the MSSQL tables.  Also check column types - we had some FLOATs in MSSQL
which were very precise and RoR initially only created the MySQL columns
with default precision, for example.  Simple fix but a gotcha.

We then bcp'd out the data from MSSQL into files, and ran a series of LOAD
DATA INFILE commands to import it into MySQL.

bcp out like so:
bcp DATABASENAME..TABLENAME out FILENAME -c -T

LOAD DATA INFILE guide:
http://dev.mysql.com/doc/refman/5.0/en/load-data.html

Two challenges:

- if you have CR or LF characters in your data, this may make working LOAD
DATA INFILE difficult.  If possible, you might run an update command prior
to BCPing to replace CR/LF characters with a special character sequence
(like ...---CRHERE---...) - then once you have it in MySQL, you could run a
command to replace the sequence with a CR or LF.

- MySQL ignores default column values when importing data using LOAD DATA
INFILE.  I ranted about this last week; it's terrible, awful, no good, very
bad database software behavior, but that's the way it is right now.  We
devised a series of commands to apply needed defaults to the columns we
needed, but in some cases (if you have a lot of NULL values for example)
this could be a lot of work

HTH,
Dan

On 4/11/07, Schalk Neethling <[EMAIL PROTECTED]> wrote:

HI All,

Can anyone give me some pointers, help, point me to articles with
regards to transfering a MSSQL database to MySQL?

Thanks!
Schalk Neethling

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]


Reply via email to