babak faghihian
babak faghihian

Reputation: 7

Import txt file into my database with specific format

I am new to MySQL and I searched internet. Before I used CSV file or SQL file to import my data into DB. But now I have a text file with this format:

number  
989399999999    
989388888888    
989384444444

This continues about 300 records. How can I import this to my database?

Upvotes: 0

Views: 289

Answers (1)

Tamil
Tamil

Reputation: 5358

LOAD DATA INFILE

The LOAD DATA INFILE statement reads rows from a text file into a table at a very high speed. The file name must be given as a literal string.

LOAD DATA LOCAL INFILE 'C:\\Users\\hi\\Desktop\\abc.txt' INTO TABLE customer LINES TERMINATED BY '\n' IGNORE 1 LINES

Query is self explanatory I hope :)

Upvotes: 1

Related Questions