MySQL Forums
Forum List  »  Newbie

Problem importing from .txt
Posted by: Sandro Lunghi
Date: June 21, 2017 02:49PM

I'm importing addresses from a .txt file. Some addresses are simple number & road (type 1) but some have a comma separating two separate pieces of data, eg house name, road (type 2). I have used the following syntax:

load data local infile 'xxx.txt'
into table NameAddress
fields terminated by '\t'
lines terminated by '\r\n';

The type 1 address imports perfectly but type 2 imports the address but puts the data in inverted commas, eg "House Name, Road Name" which I don't want. I have tried to get around this by inserting a optionally enclosed by "" line but this doesn't seem to work:

load data local infile 'xxx.txt'
into table NameAddress
fields terminated by '\t'
optionally enclosed by ""
lines terminated by '\r\n';

Can anyone help me?

Many thanks

Options: ReplyQuote


Subject
Written By
Posted
Problem importing from .txt
June 21, 2017 02:49PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.