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 > Load data to MySql with varying comma delimited data

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-09-04, 19:39
juanandrad juanandrad is offline
Registered User
 
Join Date: Jan 2004
Posts: 1
Load data to MySql with varying comma delimited data

I have a (CDR) text data file delimited by commas. Each entry varies from 20 to 37 entries per line. How do I insert this data into a MySql database and make sure each field is always placed in the same column?

Sample:

IS,1018387657,204252,16820,9b71dfce933daa55f0f2cd8 f01970c6f,4909651,5,NumB,1,F,NamB,1,F,Name,1,,VarI D,1,borg_telcom,40,1,9d66ae38-1dd1-11b2-a31c800001fffd42,sylantro,PU,4085584731,SIP,SIP,si p:4085584731@172.16.130.9:5060;user=phone,billing, AUDIO,alphacs.syltrx.com,1

IS,1018387657,204252,16820,9b71dfce933daa55f0f2cd8 f01970c6f,4
909651,1,NumB,1,F,9d66ae38-1dd1-11b2-a31c-800001fffd42,sylantro,PU,408558473
1,SIP,SIP,sip:4085584731@172.16.130.9:5060;user=ph one,sylan
tro_billing,AUDIO,alphacs.syltrx.com,1

Line 1 has 37 comma delimeted fields as opposed to line 2 that only has 23.

Thanks in advance.
Reply With Quote
  #2 (permalink)  
Old 01-10-04, 04:55
monsterhosting monsterhosting is offline
Registered User
 
Join Date: Jan 2004
Location: Vancouver, BC
Posts: 9
I would paste Line 1 into Excel so you get all the fields you need and then paste Line 2 into the appropriate columns. Then I would use concantonate to pull it back into the format I need. Copy from Excel to notepad and save.
Reply With Quote
  #3 (permalink)  
Old 01-13-04, 18:47
mwjawish mwjawish is offline
Registered User
 
Join Date: Dec 2003
Posts: 7
Re: Load data to MySql with varying comma delimited data

have you heard of split method?
you can read a line form the file using systemfile object
then split it using split method in VB
then insert each part in its plase!!

get it or you need an example?
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