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!

Import CSV file with numeric data

Status
Not open for further replies.

wally0001

Technical User
Jul 20, 2003
1
US
I am trying to import a CSV file which was exported from another mysql database with comma separation and quote delimeters. A numeric column is enclosed in quotes and cannot be directly imported into the target table since it is now a string.

How should I import this data? I have tried to import it to an intermediate table with the id column defined as a varchar but I have been unable to convert that value back to a number.

Any suggestions?
 
You should be able to import it no problem if you use something like:
[tt]
LOAD DATA LOCAL INFILE '/path/myfile.csv'
INTO TABLE mytable
FIELDS TERMINATED BY ',' ENCLOSED BY '"'
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top