Forum Moderators: open

Message Too Old, No Replies

Sql Server conversion to mysql.

         

rpiz

6:44 am on Aug 12, 2008 (gmt 0)

10+ Year Member



Hi all,

I already do a conversion on my database(Mssql) to mysql.
The problem is some on the datatype no compatible with mysql.

For example bit(mssql)[TRUE/FALSE] ---> tinyint(mysql)[1/0].

This is not successful. In mysql, there is no datatype for TRUE and FALSE. Any suggestion? What datatype I should use?

ZydoSEO

1:52 pm on Aug 12, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hmmmm... MySQL has a BOOL/BOOLEAN and BIT(1) datatypes which are synonyms for TINYINT(1) where Zero is False and non-zero values are True.

Not sure what you are using to convert the data, but if you're exporting from MSSQL to a file and then importing into MySQL then you should be able to export all BIT values of TRUE as a 1 and all BIT values of FALSE as a 0. And then import them into a MySQL TINYINT(1) or BOOL/BOOLEAN or BIT(1) field directly.

For example, if in MSSQL you have a table called MyTable with a field called MyBitField you should be able to export the table similar to the following:

SELECT
CASE MyBitField
WHEN true THEN 1
ELSE 0
END , field2, field3
FROM MyTable

[edited by: ZydoSEO at 1:57 pm (utc) on Aug. 12, 2008]