J
J
jet222014-07-22 11:51:46
csv
jet22, 2014-07-22 11:51:46

How to properly import CSV to SQL?

I ran into a problem with importing CSV separated by semicolons and quoted. in SQL format. I'm using import in php my admin, however it doesn't separate fields correctly on import. Apparently it reacts to some characters found in the string. It turns out that the data is either truncated, or completely fall into the wrong field. The first row contains the headers. Please help me figure it out!
Here is the file:
www.ex.ua/view/79705458

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Entelis, 2014-07-22
@jet22

dev.mysql.com/doc/refman/5.1/en/load-data.html

LOAD DATA INFILE 'data.txt' INTO TABLE tbl_name
  FIELDS TERMINATED BY ',' ENCLOSED BY '"'
  LINES TERMINATED BY '\r\n'
  IGNORE 1 LINES;

If you really want to, you can import from Excel:
dev.mysql.com/doc/refman/5.6/en/mysql-for-excel-in...
dev.mysql.com/doc/refman/5.6/en/mysql -for-excel-ex...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question