x
login about faq Site discussion (meta-askssc)

Import text file in sql 2005

we have few text files, which have huge no of records and I have to import into staging area (temporay tables) for further processing.

I just wanted to know which is best way to import them into tables.

  1. BCP
  2. Bulk Insert
  3. SSIS
  4. Or any other best way.
more ▼

asked Oct 03 '10 at 02:07 AM in Default

adnan gravatar image

adnan
1 1 1 1

(comments are locked)
10|1200 characters needed characters left

3 answers: sort voted first

I sat in on Thomas Kejser's session on "Designing and Tuning high speed data loading" at SQLBits 7, where he showed that SSIS was fast, but in some circumstances could be beaten by BCP.

I would recommend getting the video and slide deck from the SQLBits website (when they become available - should only be a few days off now), and maybe even checking out his and his colleagues' work on SQLCAT

more ▼

answered Oct 04 '10 at 05:52 AM

Kev Riley gravatar image

Kev Riley ♦♦
46k 38 43 69

Agreed on that. Thomas' presentations are quite eye-opening. I would be suprised if the tuning recommendations from Thomas were pertinant to most loads though - we don't all have to load TBs of data in record time!

Oct 04 '10 at 05:57 AM WilliamD
(comments are locked)
10|1200 characters needed characters left

I agree with @Hakan, SSIS would be the best long term decision. Where are these flat files coming from, is someone else in your organization producing them? Is it a data dump from another database, could you fetch this data yourself? I find this many times at my shop where I am asked to import data to do some transform of it only to extract it to another format. At least half the time I am able to pull the data myself from their SQL or MYSQL database and not have to touch their "report". Best of luck.

more ▼

answered Oct 03 '10 at 06:47 AM

Tim gravatar image

Tim
31.5k 20 30 116

(comments are locked)
10|1200 characters needed characters left

With a huge number of records I would use SSIS with fast load option and set the batch size to a couple of thousands. BCP and bulk insert can also be uesd, but if you later decide that you need some kind of workflow, transformations or parallell processing then the SSIS is the best option without having to rewrite anything.

more ▼

answered Oct 03 '10 at 03:12 AM

Håkan Winther gravatar image

Håkan Winther
15k 29 35 46

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments



Facebook logo Follow Ask SSC on Facebook
Find Ask SSC on Google+
linkedin logo Find us on LinkedIn

Topics:

x749
x58
x36
x25

asked: Oct 03 '10 at 02:07 AM

Seen: 1262 times

Last Updated: Oct 04 '10 at 06:04 AM

Copyright © 2002-2012 Simple Talk Publishing. All Rights Reserved. If you have any queries, please contact the site administrators.
Ask SQL Server Central is a community service provided by Red Gate.