Using BULK INSERT to insert rows from SQL Server dataset to table

I am importing data from a.xls file. First I took the data in the dataset and called the INSERT stored procedure. The problem is that while calling the INSERT stored procedure, the stored procedure is called to each row for the dataset. How can I use BULK INSERT for inserting all rows from a SQL Server dataset to a table?

    Requires Free Membership to View

You can use the SqlBulkCopy class in ADO.NET to quickly and efficiently load a SQL Server table from a DataTable object. For more details, read BULK insert to import data from file to SQL Server database.

This was first published in February 2008

Join the conversationComment

Share
Comments

    Results

    Contribute to the conversation

    All fields are required. Comments will appear at the bottom of the article.