Ali, Saqib wrote:
I exported a large data set from from Microsoft SQL server in CSV
format. However whenever I try to import that data to a a mySQL server
running on Linux, it adds a space between each character in each
field.
Essentially:
Saqib Ali
becomes
S a q i b A l i
I have tried to use the dos2unix cmd on linux, but that didn't help either.
I am using the following SQL to import the data:
LOAD DATA LOCAL INFILE '/home/saqib/data.csv' INTO TABLE apps FIELDS
TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n';
You SQL Server export will be Unicode, UTF8 or UTF16 ... thus the
appearance of the extra spaces. (That's just coincidence, they're not
really extra spaces ... the text editor you're viewing the file with is
treating the data as ASCII, and not recognising the multi-byte nature of
the characters.)
Change your MySQL character set for the "apps" table appropriately (i.e.
make it match the character set of the data), and see what happens.
Alternatively, create a staging table with the right character set to
load the data into first, and then convert it using an insert ...
cast... style statement into your apps table (basic ETL).
Ciao
Fuzzy
:-)
------------------------------------------------
Dazed and confused about technology for 20 years
http://fuzzydata.wordpress.com/
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]