MySQL Text Import issue

Posted on 2014-03-12
Last Modified: 2014-03-24

I am trying to import around 4000 lines from a text file into a mysql. Below is a sample from the files

There are 3 Columns in the Table - Name, DN and Description

EM Phone                             **5014                                 EM Phone
EM Phone                             **5015                                 EM Phone
EM Phone                             **5016                                 EM Phone
EM Phone                             **5017                                 EM Phone
EM Phone                             **5018                                 EM Phone
EM Phone                             **5019                                 EM Phone
EM Phone                             **5020                                 EM Phone
EM Phone                             **5021                                 EM Phone
EM Phone                             **5022                                 EM Phone
EM Phone                             **5023                                 EM Phone
EM Phone                             **5024                                 EM Phone

I do the import based on tab seperation into MySQL however this is how it appears. What should be my Name and DN are put into the single Column and the rest is left out.

| EM Phone                             **5014                  | NULL | NULL        |
| EM Phone                             **5015                  | NULL | NULL        |
| EM Phone                             **5016                  | NULL | NULL        |
| EM Phone                             **5017                  | NULL | NULL        |
| EM Phone                             **5018                  | NULL | NULL        |
| EM Phone                             **5019                  | NULL | NULL        |
| EM Phone                             **5020                  | NULL | NULL        |
| EM Phone                             **5021                  | NULL | NULL        |
| EM Phone                             **5022                  | NULL | NULL        |
| EM Phone                             **5023                  | NULL | NULL        |
| EM Phone                             **5024                  | NULL | NULL        |

I am new to MySQL so I would appreciate if someone could tell me how I can import my data correctly.

Thanks in advance!
Question by:mark_06
  • 2
  • 2
LVL 58

Expert Comment

ID: 39925250
Are you importing it directly into MySQL from the text file?
Do the columns match up and in the same order?

Author Comment

ID: 39925309
Yes I am importing directly from the text file into MySQL. The columns are in the same order and appear to match up from what I can tell. I can import the file into Excel (for testing it needs to do it automatically) and it works ok.
LVL 58

Expert Comment

ID: 39925382
Can you do an export of the table structure and post here and attach some sample rows from your text file (don't post them I need them in the exact same format as you have them)
LVL 26

Accepted Solution

skullnobrains earned 500 total points
ID: 39932653
post a few sample lines as requested above, and the 'load data infile' statement you are using as well

my guess would be
- your file is not tab-separated or you did not specify tab as the separator
- the end of the rows containing the descriptions are missing because they are beyond the field's size

Author Closing Comment

ID: 39950191
Tabs were not separated correctly

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Need Distinct Value from Joined Tables in MSSQL 5 50
simple mysql statement 3 31
syadmin MSSQL 2 57
SQL Server encoding for storing Indian languages 9 27
SQL Command Tool comes with APEX under SQL Workshop. It helps us to make changes on the database directly using a graphical user interface. This helps us writing any SQL/ PLSQL queries and execute it on the database and we can create any database ob…
Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now