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
 Import/Export (DTS) and Replication (2000)
 Import from csv files

Author  Topic 

thundr51
Starting Member

6 Posts

Posted - 2004-04-20 : 15:10:53
I'm trying to create a package that I can use to import a csv file into a table. I can do this easy enough, but the problems are
1. The file name will changing daily
2. I need to use vb.net to create an app that will allow a user to select the file(s) to be imported

I'm relatively new to DTS and sqldts.com has helped some but most of the info there pertains only to VB6. I've scoured the net but I can't seem to find any help, you guys are my last hope...

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-04-20 : 16:07:05
Instead of using DTS, you can use T-SQL:

http://www.nigelrivett.net/ImportTextFiles.html

Tara
Go to Top of Page

thundr51
Starting Member

6 Posts

Posted - 2004-04-21 : 08:07:25
I'll give this a shot and let you know how this turns out. But I must ask, what kind of speed does this have when dealing with several files up to 5 mb? I wrote something in vb.net to parse everything I needed and shrunk everything down to an insert/update statement. Inserts where pretty quick, but updates where extremely slow. Oh well, i'll give anything a shot once.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-04-21 : 12:26:27
The T-SQL version is going to be faster than DTS. DTS brings in a lot of overhead.

Tara
Go to Top of Page

thundr51
Starting Member

6 Posts

Posted - 2004-04-23 : 08:22:49
Ok, I finally got to play with this and while I was going through the sql I noticed something. This method is perfect if you have set field counts as per the example given but i'm using a csv which means my data is comma delimited. I'd still have to go through the (tedious) task of parsing every line with to put it in the right fields.

If DTS brings in a lot of overhead would it be worth trading for the ease of parsing the lines in my file?
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2004-04-23 : 12:08:44
No you don't

just use -t"," parameter in the bcp command



Brett

8-)

EDIT: ..and 5mb? That's very small

Go to Top of Page
   

- Advertisement -