Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to load data from txt file§

Status
Not open for further replies.

6681510

Programmer
Aug 29, 2007
16
FI
hi i have a text file like this
NAME PRICE

FSCCLIWEWW 2,89
SFGAAJAKLK 10,290
SHAGAJHGAS 80,54
|
TAB

NOW I WANT TO LOAD THIS DATA IN TO MYSQL TABLE

Code:
LOAD DATA LOCAL INFILE "C:/MST_FI_TEST.TXT" INTO TABLE TEST
FIELDS TERMINATED BY '\t';

now the problem is after runing this script all the DATA IS TRUNCATED from the price column because there is a ',' in the price so how can replace a comma with '.' the file so big and i have many file if i try to replace in all the files it can take much .
 
Is the data enclosed in quotes? If so, try changing your query to

Code:
LOAD DATA LOCAL INFILE "C:/MST_FI_TEST.TXT" INTO TABLE TEST
FIELDS TERMINATED BY '\t'
ENCLOSED BY '"';
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top