troubleshooting Question

Import CSV problem

Avatar of Nyackflash
NyackflashFlag for United States of America asked on
MySQL Server
5 Comments1 Solution1495 ViewsLast Modified:
I am attempting to import a text file into a 2 field table using "load data infile".

This is the file:

"01","Atlantic"
"02","Bergen"
"03","Burlington"
"04","Camden"
"05","Cape May"
"06","Cumberland"
"07","Essex"
"08","Gloucester"
"09","Hudson"
"10","Hunterdon"
"11","Mercer"
"12","Middlesex"
"13","Monmouth"
"14","Morris"
"15","Ocean"
"16","Passaic"
"17","Salem"
"18","Somerset"
"19","Sussex"
"20","Union"
"21","Warren"

Each line is terminated by a carriage return and line feed.

this is the code

INTO TABLE countiestest
      FIELDS       TERMINATED BY ','
                  ENCLOSED BY '"'
                  ESCAPED BY '\r\n'

 This code results in: Error Code: 1083. Field separator argument is not what is expected; check the manual      0.000 sec

with ESCAPED BY '\r' I get a single record back
             '01', 'Atlantic\"\n\"02'
with ESCAPED BY '\n' I get a single record back
             '01', 'Atlantic\"\r\"02'

with ESCAPED BY '\\' I get
'1', '0', 'Berg', 'Burlington\"\r\n\"04'
'5', '0', 'Cumb', 'Essex\"\r\n\"08'
'9', '0', 'Hunt', 'Mercer\"\r\n\"12'
'13', '0', 'Morr', 'Ocean\"\r\n\"16'
'17', '0', 'Some', 'Sussex\"\r\n\"20'
'21', '0', '', ''

Dose anybody have a clue what is going on here?

Bill Cook
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 5 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros