Inserting large amount of data in text files (such as CSV files) to SQL server the easiest solution is using bulk insert. This considerably reduce the execution time and increase efficiency. Assumed Altitude provide a explanation on how to do the basic type of Bulk insert in this post.
The basic insert query would like this,
The basic insert query would like this,
BULK INSERT TABLE1
FROM 'D:\test.txt'
WITH (FIELDTERMINATOR =',' , ROWTERMINATOR ='\n')
this Here the test.txt text file name and TABLE1 is where data is inserted. this just simplest form of bulk insert. This can be more complex tasks with the use of format files.