How to insert data into sql server in bulk using


 I'm building a web application. I need to read data from a text or excel file and process the data and then store the result records into database. The record number is big. I can store the data record into database (SQL Server 2005) one at a time. I think it's slow. Is there any way to insert the data in bulk.




12/27/2007 11:51:19 PM 29906 articles. 0 followers. Follow

4 Replies

Similar Articles

[PageSpeed] 9


Try DataAdapter's Update() method.

Thanks and best regards,

Faraz Shah Khan
12/28/2007 1:46:53 AM


If you want to just insert the data then you can use sqlbulkinsert class.

If you want to update already existing records then use SQLDataAdapter or having a staging table to insert records using sql bulk insert and move them to main table using a stored procedure



With Luv

Dont forget to mark as answer if my reply helped you...

12/28/2007 2:01:52 AM

U can use SQLBulkcopy  object plz check out

Thank  u


Please remember to click "Mark as Answer" on this post if it helped you. 

Thank u


Please remember to click "Mark as Answer" on this post if it helped you.
12/28/2007 4:44:51 AM

I'm not sure if I can use SQLBulkInsert. For each record retrieved from file, I need do some calculation, add some new field data, then store the record into SQL Server.

Can I create a dataset and add the resulting record to the dataset until the dataset size getting bigger, say 500, then insert the dataset into database? Will it make insert faster than insert one record each time?

If any article or example can help me, please post it.

Thank you so much!


12/28/2007 5:52:28 AM

Similar Artilces:

how do i insert data into sql server using data from textboxes and sql connection and sql command
anyone can give me a simple explaination and code.. Thanx in advance Take a look @ Sample Code: How to add...Sushila Bowalekar PatelVisual ASP/ASP.NET MVP There are a lot of tutorials out there, but I know they can be a bit confusing as they all approach things slightly differently. Basically a nice simple version would go like this:' *** First set up your connectionDim conConnection As New SqlConnection("server=servername;database=yourdatabase;uid=yourname;pwd=yourpassword;")' *** This line takes care of your sommand text and command connection in one ...

SQL Server Reporting Services for SQL SERVER 2000 AND Visual Studio.NET 2005 .NET 2.0
Hi, Which version of SQl Server Reporting Services will work with SQL SERVER 2000 in pararrel with ASP.NET 2.0 (.NET 2.0 framework)?  Thanks, Azam HighOnCodingWanna get high! Hi, Okay I got the answer. Yes, we can use the SQL SERVER 2005 Reporting Services with SQL SERVER 2000. HighOnCodingWanna get high! ...

How to Data Transfer From Excel to Microsoft SQL Server Data base Using .Net.
Hai All, How to Data Transfer From Excel to Microsoft SQL Server Data base Using .Net. I have one Excel Sheet in that sheet 15 Fields (attributes) and 3000 records are there. In this 3000 records i want to store this (Excel) data into  5 related tables on Sql Server Database Using .Net.   How to store Excel Sheet data into Sql Server database. Please help me as soon as possible. Thank You Very Much...Have a Good Day... With RegardsSridhar...

Attach SQL DB to SQL Server 2005 using VB.Net
Is there any way to attach a SQL DB to SQL Server 2005 using VB.Net?  If so can you also set security? Can you rephrase your question? Attach SQL DB from which version of SQL server ? Look up books online for sp_attachdb and sp_detachdb.***********************Dinakar NethiLife is short. Enjoy it.*********************** I have a DB that was created in SQL Server 2005.  I have a website that displays data from systems all over the world.  Each system sends it's data to it's own DB.  The customer can then go to a website and see the data at real time.  What ...

creating ssis packagte for sql server to sql serer using
Hi friendsdoes any one has code or urls which can help me to create the ssis pacakage which will transfer data from sql server to sql server databaseswith some manipulationsthanks so much Lad LaxmikantPune You are probably in the wrong forum.  This forum is for questions relating to ASP.NET Dynamic Data. thanks,David...

ADO.NET SQL-Server Text data type
Hi, dear I need to get the full text of a text datatype collumn of a sql-server table. I tried the example of this link ( and change getbytes to getchars and I didn't get the full text. What's wrong? How can I get the full text? Thank you very much. Obede Brazil...

Not able to connect to SQL SERVER using ADO.NET
Hi, I am trying to connect to SQL SERVER 2000using VS.Net 2003.I ve configured my LOCAL sql sever to use windows authentication(in enterprise manager) Ths is the connection string i use in for connection to the database 'test' in the local server.server=(LOCAL);integrated security = SSPI;database=test;1)This gives the following  error...."Login failed for <user name\ASPNET>"2)Also enteprise manager did not allow me to use sql server authentication.Please helpSat Have you added ASPNET as a user in the database? Hi Satishr23. It is possible that your log-in ac...

Inserting data in batch mode in a SQL Table using .NET
Hi, I have an ASP.NET Web Service that accepts a DataSet object passed to it. This DataSet will contain a large number of records in it's table. What I want to do (if possible) is insert all records in a SQL table in a batch mode (one go). Is this doable? Thanks,--Mazen depends on the size of the dataset.Kay - Code to live, but Live to code....

Insert Data into sql DB using backend
Hi. I need too use my backend to insert data into my database from seveeral controls on the page. I have tried writing some code to do this but i am a beginner, and i am completely stuck. Heres what i have so far   Dim userid As String = DropDownList2.SelectedValue Dim username2 As String = DropDownList1.SelectedValue Dim date2 As String = Calendar1.SelectedDate Dim invoiceid As Integer = TextBox1.Text Dim amount As Decimal = TextBox2.Text Dim conn As String = ConfigurationManager.ConnectionStrings("U...

Security Error connecting to SQL Server using
In our environment, we can successfully connect to SQL server using interface, but when we delivered the software to clients, they are having connection errors. Connection parameters all look good. I am not sure what this error is about and unfortunately, the error does not tell much. Thanks in advance for helping me out Below are the details of the error Initial Connection Error Trans Error Code: -1 DBErrorCode:999 DBMS: ADO.Net DB Error Message: System.Security.SecurityException:Request failed. at Sybase.PowerBuilder.Db.Block.OleDbBlock.Connect(String cnnStr,...

Using VB.NET to export data from SQL Server 2005 to Excel
Hi There, I just want to know how to export data from SQL Server 2005 to an excel spread sheet, using VB.NET?ThanksSJB  Everytime I should export data from SQL to Excel with code, I simply create a ; seperated file (*.csv). So if you want to do the same you can simply use ADO.Net to query your database and get a result set from your tables. Walk trough the rows and get its value and create a textfile with the System.IO namespace. The file can look like: column1;column2;column3 value1;value2;value3 value1;value2;value3 The first row can if you want have the name of the column tha...

How to resovle the Error 7399 in SQL Server 2000 while using ADO.NET?
Hello All. I have a problem. I want to transform Sheet data in Excel file to a table in SQL Server's database.And I found that there are two stored procedures in SQL Server,the one is "sp_addlinkedserver",the other is "sp_addlinkedsrvlogin". I use "sp_addlinkedserver" to add a new linked server which links a Excel file which name is "C:\Test.xls".And the linked server name is "Sheet1". "sp_addlinkedserver 'Sheet1', 'Jet 4.0','Microsoft.Jet.OLEDB.4.0','c:\Testl.xls',NULL,'Excel 8.0' then,I use SQL SA tool to access this lin...

Writing Data From SQL Server to MS Word using VB.NET
Hi All, I need to write data from SQL Server to MS Word. I have never done that and even I dont have any idea how to proceed. I really apprecite if any body can help me. Please post sample code if any. Thanks in advance, Kumar. Word has a fairly robust object model. For starters you should create windows application project and add a COM reference to the Microsoft Word type library. The following code will create a document and add some text: Dim objWord As New Word.Application() Dim objDoc As Word.Document objWord.Visible = True ...

how to insert all data from dataset to a temporary table in sql server database
I always get solutions for my question from the forum , thanks for all your help. Question is i have select some data from a database in server 1 and save it in to a DataSet in now i need to create a temporary table in server 2 test database and insert all rows in DataSet. I know I can read row by row in DataSet.Table(0) and execute a insert statement for each row. but i think this is time consuming. Is there any way that I can transfer all data in DataSet to a temporary table at once. need your help please. I am selecting data from Server 1 Datababse (original1) as follows &n...

Web resources about - How to insert data into sql server in bulk using -

Insert key - Wikipedia, the free encyclopedia
The Insert key (often abbreviated INS ) is a key commonly found on computer keyboards . It is primarily used to switch between the two text-entering ...

Inserts Wallpapers & Photos on the App Store on iTunes
Get Inserts Wallpapers & Photos on the App Store. See screenshots and ratings, and read customer reviews.

hud-dot-epa south lincoln insert - Flickr - Photo Sharing!

Lumia 640 XL - How to insert SIM and memory card - YouTube
Learn how to get started with your Lumia 640 XL or Lumia 640 XL Dual SIM. In this video you'll learn how to insert the SIM cards and the memory ...

Google Maps prankster inserts image of Android robot urinating on Apple logo
It seems even Google Maps can fall victim digital vandalism.

Dear [insert name], Qantas takes your complaint very seriously, honest
What's more annoying than being delayed nine hours on a long-haul flight between Sydney and Los Angeles, while stuck in a seat with a broken ...

Skype to insert advertising into calls
Skype to insert advertising into calls

ISIS inserts disturbing images into N.L. vote Twitter chatter
Note: The CBC does not necessarily endorse any of the views posted. By submitting your comments, you acknowledge that CBC has the right to reproduce, ...

Updates for Google Docs & Slides let you insert & quickly edit images on Android/iOS
Google is today rolling out updates to its Google Docs and Slides mobile apps bringing the ability to insert images directly from the app on ...

Gmail for iOS updated with ‘Insert from Drive’ and ‘Save to Drive’
Google has released an update to Gmail for iOS this afternoon that brings “Insert from Drive” and “Save to Drive” functionality to the iPhone ...

Resources last updated: 12/1/2015 4:26:51 PM