MySQL Forums
Forum List  »  Newbie

Importing but has white space leading/trailing
Posted by: wayne r
Date: December 15, 2009 12:13PM

New to mysql. I am import a file using:

load data local infile 'c:\\wjr\\illinois_issues.txt'
into table survey
fields terminated by '\t'
lines terminated by '\n'
;


The problem in the source file illinois_issues.txt, is an inconsistency in the data within fields. We have leading and trailing spaces in the data. To give an example of field which might contain {yes|no} you could see:
" yes"
" yes "
"yes "
as possible input. Is there any way DURING IMPORT to specify removing leading and trailing whitespaces characters?

It is an problem when trying to do selects like this:

SELECT issue1 from survey
where issue1 = 'YES';

Because we get zero results. Plus this data will be exported and cleaning up the spaces would be helpful for the next guy.

Options: ReplyQuote


Subject
Written By
Posted
Importing but has white space leading/trailing
December 15, 2009 12:13PM


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.