Ask the Expert

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

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: