Re: Most efficient way to insert 1,000,000 records?

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi,


"chrisben" <chrisben@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:208C5B43-3F21-4BF8-94CD-E3CCD8B9B79B@xxxxxxxxxxxxxxxx
> Hi,
>
> I need to insert more than 500,000 records at the end of the day in a C#
> application. I need to finish it as soon as possible.

In a C# app or in a DB used by a C# app?

> I created a stored procedure and called it from ADO to insert one by one.
> It
> is kind of slow (seems slower than using a DTS package to import from a
> file).
>
> Just a general question, in ADO, what will be the MOST efficient way to do
> this work. I normally do it as I described. I am using .NET framework 1.1
> and SQL Server 2000.

In short, none, ADO.NET is not intented for this. You have two options, use
bulk copy (bcp.exe ) that comes with SQL server or as Paldino suggested
(that is also my recommended solution) using DTS, DTS can be scripted from
C# so you will have flexibility to change it as needed.


Just create a DTS from enterprise manager, select write package to disk and
later you can load and execute it.

Let me know if you need code, I do this in a couple of deployments.



--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation


.



Relevant Pages

  • Re: SQLEM: Package Error: "The system cannot find the file specified." on open of DTS Pack
    ... Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) ... www.SQLDTS.com - The site for all your DTS needs. ... > In trying to open a DTS package from SQL Enterprise Manager, ... > the error message: "Error Source: Microsoft Data Transformation ...
    (microsoft.public.sqlserver.dts)
  • Re: Executing a DTS package from ASP.NET
    ... Hey, I have company. ... See the thread 'DTS from ... > file in my own machine, only SQL Server in another machine. ... > approach to run this DTS package triggered by web? ...
    (microsoft.public.sqlserver.dts)
  • Re: SQL 2000 - Connection Error with DTS Packages
    ... After I changed all SQL Server 'Database Connection' steps in each of my DTS ... Package" option when you right click a DTS package name in ME. ...
    (microsoft.public.sqlserver.dts)
  • Re: vb.net dataTbl can DTS read?
    ... then using ADO to read/write the data to Sql Server. ... like what DTS does with Text Files, MS Access data, etc. ... Right now I am experimenting with writing the data from ...
    (microsoft.public.sqlserver.dts)
  • Re: Permission for running DTS
    ... Add them to msdb. ... You could also go through the DTS stored procs and grant access to them ... Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) ... > still run the DTS package in any other way without adding ...
    (microsoft.public.sqlserver.dts)