Skip to content

Instantly share code, notes, and snippets.

@weeksdev
Created May 29, 2014 19:04
Show Gist options
  • Select an option

  • Save weeksdev/f660ecf004de9f8f1324 to your computer and use it in GitHub Desktop.

Select an option

Save weeksdev/f660ecf004de9f8f1324 to your computer and use it in GitHub Desktop.
SqlBulkCopy
var copy = new System.Data.SqlClient.SqlBulkCopy(connectionString);
System.Data.SqlClient.SqlCommand command = new System.Data.SqlClient.SqlCommand("select * from someTable",connection);
var reader = command.ExecuteReader();
copy.DestinationTableName = "destinationTable";
copy.WriteToServer(reader);
copy.Close();
connection.Close();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment