Solved

MySQL Text Import issue

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
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…

762 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

20 Experts available now in Live!

Get 1:1 Help Now