Bulk Copy Operation

--
--//This blog is about bulk copy operatoin:

----//Create a sqlconnection first:

using (SqlConnection sc = new

SqlConnection(connectionString))
{

sc.Open();

SqlCommand commandSourceData = new SqlCommand("SELECT * FROM

StoresBackupTablename;", sc);

SqlDataReader reader =

commandSourceData.ExecuteReader();
---
-//Second connecton

using (SqlConnection dc = new

SqlConnection(connectionString))

{

----//open second connectoin dc.Open();

using (SqlBulkCopy bulkCopy = new SqlBulkCopy(dc))

{

bulkCopy.DestinationTableName = "DestinatoinTableName";

bulkCopy.WriteToServer(reader);

}
Ebook Download
View all
Learn
View all