mgordon-spi
asked on
CSV Import
I am importing a csv file into my Database. It is a comma delimitered file.
I have 2 tables
tPhonebook - ID, sBook
tContacts - ID, sName, sPhone, iPhonebookID
iPhonebookID is linked to ID of tPhonebook
The csv file consists of
Column 1 - Name
Column 2 - Number
Column 3, 4, 5 etc is the name of a Phonebook.
I need the import to add a phone book for every column named after column 2, it could be one or multiple columns, it is different for every row.
I then need it to add that contact to each phone book and move to the next row.
If the phone book exists already I just need to ID for iPhonebookID.
I have 2 tables
tPhonebook - ID, sBook
tContacts - ID, sName, sPhone, iPhonebookID
iPhonebookID is linked to ID of tPhonebook
The csv file consists of
Column 1 - Name
Column 2 - Number
Column 3, 4, 5 etc is the name of a Phonebook.
I need the import to add a phone book for every column named after column 2, it could be one or multiple columns, it is different for every row.
I then need it to add that contact to each phone book and move to the next row.
If the phone book exists already I just need to ID for iPhonebookID.
Hi,
try below CSV Import Sample
http://www.codeproject.com/Articles/9258/A-Fast-CSV-Reader
hth
Kalpesh
try below CSV Import Sample
http://www.codeproject.com/Articles/9258/A-Fast-CSV-Reader
hth
Kalpesh
ASKER
The csv would be like this
John, 123456, Phonebook1,
John, 123456, Phonebook1, Phonebook2, Phonebook3,
John, 123456, Phonebook1, Phonebook2,
if there is only one phone book there is only 3 columns if there is 2 phone books there is 4 columns and so on. There would never be a null column and then a phone book column
John, 123456, Phonebook1,
John, 123456, Phonebook1, Phonebook2, Phonebook3,
John, 123456, Phonebook1, Phonebook2,
if there is only one phone book there is only 3 columns if there is 2 phone books there is 4 columns and so on. There would never be a null column and then a phone book column
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Name, Number, Col1, Col2, Col3
--------------------------
John, 123456, Phonebook1, NULL, NULL
John, 123456, NULL, Phonebook2, NULL