SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Import from csv files
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

thundr51
Starting Member

6 Posts

Posted - 04/20/2004 :  15:10:53  Show Profile  Reply with Quote
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

USA
36845 Posts

Posted - 04/20/2004 :  16:07:05  Show Profile  Visit tkizer's Homepage  Reply with Quote
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 - 04/21/2004 :  08:07:25  Show Profile  Reply with Quote
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

USA
36845 Posts

Posted - 04/21/2004 :  12:26:27  Show Profile  Visit tkizer's Homepage  Reply with Quote
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 - 04/23/2004 :  08:22:49  Show Profile  Reply with Quote
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 - 04/23/2004 :  12:08:44  Show Profile  Reply with Quote
No you don't

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



Brett

8-)

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


Edited by - X002548 on 04/23/2004 12:10:03
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.12 seconds. Powered By: Snitz Forums 2000