How do I use the "LOAD DATA INFILE" command?

Asked

Viewed 4,727 times

0

It is the following guys, I have a database and in it a table called "people" which contains "id_people" as attribute and I want to test an import of information using this command of the title, I have already saved an excel file in the format ". csv" as follows: inserir a descrição da imagem aqui

http://blog.professorulisses.com/index.php/2015/05/20/importacao-de-dados-do-excel-para-o-mysql/ : In this article the author teaches to use but does not make clear how to indicate the path in which the file is, someone could give a help and explain the parameters?

  • I think it’s written in this line: Próximo passo é executar o comando de importação do MySQL. LOAD DATA INFILE ‘/TEMP/EXEMPLO.CSV’ INTO TABLE TEM_CLIENTE FIELDS TERMINATED BY ‘;’ (NOME,SEXO, DT_NASC);

  • Whereas /TEMP/EXEMPLO.CSV is the file path. Voce places where your file is.

  • Keeps showing error when running this command: LOAD DATA INFILE C:\Users\Wallace\Desktop\atividade\dadoss.csv INTO TABLE pessoas_documento FIELDS TERMINATED BY ; (idPeople);

  • Which error is shown?

  • "You have a syntax error in your SQL next to 'C:\Users\Wallace\Desktop\atividade\dadoss.csv INTO TABLE pessoas_documento ' on line 1"

1 answer

1

I managed using the command this way:

LOAD DATA LOCAL INFILE 'C:Users/Wallace/Desktop/activity/data.txt' INTO TABLE people;

Browser other questions tagged

You are not signed in. Login or sign up in order to post.