ExcelCSV parser & database update.

N

Nag

I have a excel sheet in CSV format. I want to parse the cell contents
row by row and update it to different tables with cell data.
Consider that excel sheet has 12 columns.
Out of 12 columns, first 3 are coulmn values are inputs for updating
table1. and next 3 columns values are inputs for
updating table2.............like till table4.
What is the best way to update the database here..?
Updating 4 tables at the end of reading first row is one way.
Is there any better approach to minimize the database hits.

thanks for your inputs.
 
S

shriop

Use a csv parser and a csv writer like mine for example,
http://www.csvreader.com . Read in the csv file row by row using the
csv parser. Have 4 open csv writers to 4 separate files. Write the
first 3 columns to one writer, the next 3 columns to the next writer,
etc. When the parser is done reading in the file row by row, close it
down and close down all 4 writers. Bulk import all 4 files into the
database into temp loading tables, using dts for example if you're on
sql server. Once you have all 4 tables worth of data in the database,
run 1 bulk update for each of your temp tables joining in to whatever
table they're updating. It sounds kind of crazy, but it's actually
pretty straightforward once you get going, and will perform the best of
any options even across huge amounts of data.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top