Solved

MySQL Text Import issue

Posted on 2014-03-12
5
390 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 27

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

This article describes some very basic things about SQL Server filegroups.
As technology users and professionals, we’re always learning. Our universal interest in advancing our knowledge of the trade is unmatched by most industries. It’s a curiosity that makes sense, given the climate of change. Within that, there lies a…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
The viewer will learn how to dynamically set the form action using jQuery.

765 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