SQL Bulk insert and ADO .NET SQLBulkCopy
--SQL Procedure to insert data from a comma delimited text file
use MyDatabase
--- Create a temp table to hold the data
CREATE TABLE TmpStList
(
username varchar (100) NOT NULL,
userpassword varchar (100) NOT NULL,
)
go
--bulk insert from a text file
BULK INSERT tmpStList FROM 'C:\temp.txt' WITH (FIELDTERMINATOR = ',')
go
-- insert into a destination table
INSERT memphisgives2008 (username,userpassword)
SELECT username, userPassword
FROM tmpStList
In ADO .NET, SqlBulkCopy is the object that helps you to perform a bulk copy. You can use a DataReader or DataTable as source data store (you can load your data from SQL database, Access database, XML or ... into these objects easily) and copy them to a destination table in database.
The following is an example explaining in detail.
http://dotnetslackers.com/articles/ado_net/SqlBulkCopy_in_ADO_NET_2_0.aspx