mySQL import scripting

how do I import non-delimited data into mysql?

the column location is identified by field number

example

column 1 is fields 1 through 14
column 2 is fields 15 through 40
gevansmdesAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave BaldwinFixer of ProblemsCommented:
Here's the MySQL page http://dev.mysql.com/doc/refman/5.1/en/load-data.html but I don't see a method for position-delimited files.  I would import it into Excel/LibreOffice first and then export as CSV.  Then MySQL or phpmyadmin can import it.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ukerandiCommented:
see below example

LOAD DATA INFILE 'data.txt' INTO TABLE db2.my_table;
0
ukerandiCommented:
First create temparaly table
then use below code to import file
LOAD DATA INFILE 'data.txt' INTO TABLE db2.my_table;

then write following code to export
SELECT Field14,Field40 INTO OUTFILE '/tmp/result.txt'
  FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
  LINES TERMINATED BY '\n'
  FROM test_table;

then Import back using following code
LOAD DATA INFILE 'result.txt' INTO TABLE persondata (Field1,Field15);


or you can use following steps
http://computeraxe.com/how-to-import-data-file-mysql-phpmyadmin/
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

ukerandiCommented:
0
ukerandiCommented:
this will work
load data infile 'yourfilename.txt'
into table [Yourtablename]
fields terminated by '|'
lines terminated by '\n'
(col1,
col15,
@col14,
@col40)
0
Ray PaseurCommented:
Please post a representative example of the data in the code snippet (or attach a file).  Once we can see exactly what sort of thing you have we can probably offer some concrete suggestions.  Thanks, ~Ray
0
gevansmdesAuthor Commented:
thank you
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.