Problems replacing aphostophies
Posted on 2012-04-13
I was hoping that someone might help me understand why a problem I had importing data occurred and how I can resolve it if it happens in the future.
I was importing data using mySQL workbench and used MS Excel / MS Word to add apostrophes around the text before I imported it. I then encountered an error when mySQL did not like one of the apostrophes.
(1,'Administrator',6,15,25,‘2012-04-13 00:00:00','1899-12-30 12:18:00','T Administrator')
Only the apostrophe before 2012-04 caused a problem but no matter what I replaced it with in Word, mySQL refused to accept it. In the end, since I only had 50 records, I changed them all by hand to get the data import to work.
I would appreciate if someone could tell me what causes this behaviour and how to get around it. Why would only one apostrophe be different – I originally added them all in MS Excel before saving the file in a .csv format, opening it in MS Word.
The steps I took were:
1) added single quotes around some columns that contained data i.e. =”’” & C4 & “’”
2) Copied column and pasted Values only
3) Copied all columns into table in MS Word
4) Converted table to text using commas as field break
5) Replaced all paragraphs with ),( adding an initial opening bracket
6) Copied into MySQL and made it into an Insert query