If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Importing CSV help

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old
Registered User
 
Join Date: Dec 2012
Posts: 3
Importing CSV help

Ok so I'm simply trying to import this CSV file into a table within my database. I want a total of 2 columns. 1 being the type, and 2 being the code. I have looked at this file in notepad and excel and I don't know how to fix it. When I import it, I see the columns type & code, but all the information ends up in the one column 'type'.

Here is what shows in the table without information :Screenshot

Here is what the table looks like with the information: Screenshot

And here is the first few lines of code. There are 1600 lines of code total and they all are setup just like these. This is my first time using csv files so I'm sure I'm making a silly mistake. I just don't know what! Any help would be great.

Code:
BA-5000turns,BAM-5000-reserve-turns7883WIH129MT714N14
BA-5000turns,BAM-5000-reserve-turns1824AIO387KB840Y17
BA-5000turns,BAM-5000-reserve-turns6339YZQ580SX820G15
BA-5000turns,BAM-5000-reserve-turns2034JMN639IH946E16
BA-5000turns,BAM-5000-reserve-turns1161OGH216MY785L16
BA-5000turns,BAM-5000-reserve-turns5877MBW840IA501X22
BA-5000turns,BAM-5000-reserve-turns3839CZP722YW855S12
BA-5000turns,BAM-5000-reserve-turns6632UDQ942WH613G11
BA-5000turns,BAM-5000-reserve-turns1962FVQ307XE904A20
BA-5000turns,BAM-5000-reserve-turns3539ICG248WX391E18
BA-5000turns,BAM-5000-reserve-turns9256QWS178ZP844V21
BA-25000turns,BAM-25000-free-turns6825TNH558FZ518Q17
BA-25000turns,BAM-25000-free-turns7391RVE817JG119I15
BA-25000turns,BAM-25000-free-turns3757ZVX763LQ953W22
BA-25000turns,BAM-25000-free-turns2303BKN686WZ482A13
BA-25000turns,BAM-25000-free-turns6295UPG635TQ847I20
BA-25000turns,BAM-25000-free-turns7924NEZ446JI816X17
BA-goldsub,BAM-3-days-gold-subscription-2333DJK668AW826X16
BA-goldsub,BAM-3-days-gold-subscription-5069YQR301PH817X17
BA-goldsub,BAM-3-days-gold-subscription-6793VCT643MH857F20
BA-goldsub,BAM-3-days-gold-subscription-1995MOE245UW482L15
BA-goldsub,BAM-3-days-gold-subscription-9675RPV625FL689C14
BA-goldsub,BAM-3-days-gold-subscription-9636FMR210OV627J19
This is what the file looks like within excel: Screenshot
Reply With Quote
  #2 (permalink)  
Old
Registered User
 
Join Date: Sep 2009
Location: San Sebastian, Spain
Posts: 860
Show us the code or commands you used to load the data? You have to make sure that your field separator is the comma ",".
__________________
Ronan Cashell
Certified Oracle DBA/Certified MySQL Expert (DBA & Cluster DBA)
http://www.it-iss.com
Reply With Quote
  #3 (permalink)  
Old
Registered User
 
Join Date: Oct 2009
Location: 221B Baker St.
Posts: 487
How did you define the delimiter to be used for the import?
Reply With Quote
  #4 (permalink)  
Old
Registered User
 
Join Date: Dec 2012
Posts: 3
I actually managed to figure it out, not entirely sure how. But it worked. Thanks to those that responded!
Reply With Quote
  #5 (permalink)  
Old
Registered User
 
Join Date: Sep 2009
Location: San Sebastian, Spain
Posts: 860
If you could post your import code this might help others who have a similar issue in the future?
__________________
Ronan Cashell
Certified Oracle DBA/Certified MySQL Expert (DBA & Cluster DBA)
http://www.it-iss.com
Reply With Quote
  #6 (permalink)  
Old
Registered User
 
Join Date: Dec 2012
Posts: 3
I didn't change the code, just kept fiddling with settings in the database until something worked. Not very experienced at this stuff, so I really couldn't tell you what I did to make it work.
Reply With Quote
  #7 (permalink)  
Old
Registered User
 
Join Date: Oct 2009
Location: 221B Baker St.
Posts: 487
Quote:
so I really couldn't tell you what I did to make it work.
I suspect the "fix" was telling the import that the comma was the delimiter?
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On