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)
 Data Import Solution

Author  Topic 

maximus_vj
Yak Posting Veteran

88 Posts

Posted - 2005-03-17 : 16:02:02
Hello,

I have 3 csv files. All I have to do is import data from these files into my SQL Server tables. I do not have to transform the data.

Ex CSV file is:
"subject","descr"
"AGR","Agriculture"
"ANY","Any"
"DAN","Arts: Dance"

The first line has column headings in my CSV file.


Can you tell me which is the best way to do? DTS,BULK INSERT or BCP?

Is it better to import the data into temporary staging table and then use T-SQL to copy data from this staging table to my original table?

Thanks
maximus_vj

eyechart
Master Smack Fu Yak Hacker

3575 Posts

Posted - 2005-03-17 : 16:18:34
take your pick with the method to use. Most people starting out work with DTS for things like this. As you do this more and more of this type of work BCP becomes more popular. Either way, you achieve the same thing.

As for a staging table, that is usually a good step to take. I like to use the staging table so I can just blast the data in there. A second step inserts that data to where it really needs to be.

I usually keep my data staged for a while, in case I have to re-process it. Staging it this way allows you to massage the data a little also (if needed). dealing with constraints is also easier (in my opinion) with an insert statement.



-ec
Go to Top of Page

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2005-03-17 : 20:54:40
We do what ec says.
BULK INSERT into a stage table, then INSERT from stage table into the destination table(s).
Sometimes we use DTS iof BULK INSERT, (if the source is not in textfile, eg odbc connection)
But we always (99%) go through a stage table. (The stage table allows nulls and has no constraints)

rockmoose
Go to Top of Page
   

- Advertisement -