Solved

MySQL Text Import issue

Posted on 2014-03-12
5
387 Views
Last Modified: 2014-03-24
Hi,

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!
0
Comment
Question by:mark_06
  • 2
  • 2
5 Comments
 
LVL 58

Expert Comment

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

Author Comment

by:mark_06
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.
0
 
LVL 58

Expert Comment

by:Gary
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)
0
 
LVL 26

Accepted Solution

by:
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
0
 
LVL 6

Author Closing Comment

by:mark_06
ID: 39950191
Tabs were not separated correctly
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

APEX (Application Express) is used to develop a web application from Oracle. SQL Workshop is one of the tools that comes with Oracle APEX to query or modify the database objects or to make any changes to the structure.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…

809 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