Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Huge CSV File

Author  Topic 

jackstow
Posting Yak Master

160 Posts

Posted - 2002-01-28 : 06:52:34
I'm trying to parse a csv file that contains 15,000+ rows and 1,000,000+ characters and insert the contents into a table. The only two options I can think of seem to be looping through the file line by line and inserting via a stored procedure one line at a time - this takes forever and the whole thing times out - or passing the whole lot as an array - but it's well beyond any datatype I could use I think (i.e. char(8000)) - and then looping through the array.
It's a cold and wet Monday morning...
Any bright ideas out there?

Jack

Andraax
Aged Yak Warrior

790 Posts

Posted - 2002-01-28 : 07:05:28
Hi!

Have you tried using the SQL server DTS to do the job?

I have imported files of over 150 MB with 500000 rows using the DTS, without problems. I have done this using SQL server 2000 SP1 or higher.

Regards,
Kalle Dahlberg



Go to Top of Page

jackstow
Posting Yak Master

160 Posts

Posted - 2002-01-28 : 08:21:12
Thanks - I might give that a go. I've also just discovered this article - http://www.sqlteam.com/item.asp?ItemID=3207 - which uses BULK INSERT. Could be the way to go..

Go to Top of Page

davidpardoe
Constraint Violating Yak Guru

324 Posts

Posted - 2002-01-28 : 10:47:25
For one application I need to load a CSV file with > 3 million records and >250 fields. I posted the following for which I got a few useful replies. If you have any further questions then post them here!

http://www.sqlteam.com/Forums/topic.asp?TOPIC_ID=8045

============
The Dabbler!
Go to Top of Page

jackstow
Posting Yak Master

160 Posts

Posted - 2002-01-28 : 11:59:02
Wow - I'm getting CSV file envy now! For my problem the BULK INSERT seems to be working fine. The script I'm rewriting used ASP/VBScript to upload the file and loop through it - it was dreadfully slow and as the file is uploaded by a client to their website on a dial-up connection it was even slower.. Now with VB.NET for the upload, a stored proc to bulk insert the data into a temp table and a job to update the database later on with the temp table data the whole thing runs a lot faster. Thanks to SQLTeam again!

Jack

Go to Top of Page
   

- Advertisement -