Chris
Chris

Reputation: 408

How to insert values in a field of a table in MySQL, from .txt file

how can i insert values in a field of a table in MySQL, from a .txt file line for line ?

My .txt is like:

name1
name2
name3
name4

(line per line)

i read a lot on Stackoverflow, i found this: insert in mysql table from .txt file

but my situation is little different, i'm triyng to modify the linked post's query, but unsuccesful :-( thanks !!

Upvotes: 0

Views: 157

Answers (1)

AnandPhadke
AnandPhadke

Reputation: 13496

LOAD DATA INFILE 'testfile.txt'
INTO TABLE testtable
FIELDS TERMINATED BY '\r' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
(name);

Upvotes: 1

Related Questions