HighTechTalks DotNet Forums  

Data Import: From Memory to Table

Dotnet Data Tools microsoft.public.dotnet.datatools


Discuss Data Import: From Memory to Table in the Dotnet Data Tools forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
jason chern
 
Posts: n/a

Default Data Import: From Memory to Table - 09-16-2004 , 08:19 PM






Hi,

I'm working on a C# program for database I/O using System.Data.SqlClient.
My question is, if I have data stored in an array, is there a fast way to
import data from an array to a table (similar to BULK INSERT)? I'm using SQL
ommand 'INSERT INTO' to import data record by record but it is very slow when
the array is large.

Any suggestions would be appreciated.

Compiler: Visual .NET 2003
Database: SQL Server 2000
OS: Windows Server 2000

Reply With Quote
  #2  
Old   
Jonathan Levine
 
Posts: n/a

Default RE: Data Import: From Memory to Table - 09-16-2004 , 09:35 PM






Jason,

"jason chern" wrote:
Quote:
I'm working on a C# program for database I/O using System.Data.SqlClient.
My question is, if I have data stored in an array, is there a fast way to
import data from an array to a table (similar to BULK INSERT)? I'm using SQL
ommand 'INSERT INTO' to import data record by record but it is very slow when
the array is large.
My experience is that INSERT into a small table without indexes is usually
pretty fast.
How large is the target table? Do you have a lot of indexes on it? If both
are true, and the number of rows to insert is very large, you could consider
creating a temp table without any indexes, loading into that, then using
INSERT...SELECT from the temp table into the permanent table. If there are
relatively a lot of rows to insert, then depending on the number of indexes,
you could consider dropping the indexes on the permanent table before the
INSERT...SELECT, then rebuilding them afterwards.

Regards,
Jonathan

Regards,
Jonathan


Reply With Quote
  #3  
Old   
ambshah
 
Posts: n/a

Default Re: Data Import: From Memory to Table - 09-29-2004 , 03:46 AM



you can create a stored procedure that accepts
the values , and then fire the procedure in a loop
its fast !!



"jason chern" <jchern (AT) sivtec (DOT) com> wrote

Quote:
Hi,

I'm working on a C# program for database I/O using System.Data.SqlClient.
My question is, if I have data stored in an array, is there a fast way to
import data from an array to a table (similar to BULK INSERT)? I'm using
SQL
ommand 'INSERT INTO' to import data record by record but it is very slow
when
the array is large.

Any suggestions would be appreciated.

Compiler: Visual .NET 2003
Database: SQL Server 2000
OS: Windows Server 2000



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.