As the title suggested we are going to see how do we insert bulk number of records from a text file to a SQL 2005 table. The technique is we should have the records in the text file in such a way that a columns and rows of records are terminated by unique letters. We call these letters as Field terminator and row terminator. We will experiment this with a quick walk through.
1) Connect to the NorthWnd database. (Don't know what is NorthWnd db? Google it)
2) Then Query the product table as shown below:

3) Next, Click on the No Column name to select the entire row under this single column
4) Then, Right click and copy the selected rows and paste it to a notepad.
5) Save it as Products~.txt in D:\
The text file now has the data for the bulk insert explanation. Note that the field terminator is ‘~' and row terminator is new line character ‘\n'. Now we will create table that will consume the data from this text file.
6) Create a table as shown below in the NorthWnd DB


Zoran HorvatPosted Apr 14, 2013, 7:32 AM
Hi Sivaraman, have you considered using SqlBulkCopy class from C# code for this task? Please take a look at my article which inserts a million parent-child records per minute with ID values recollection, without relying on BULK INSERT statement and external files: http://www.sysexpand.com/?path=howto/bulk-insert