Tuesday, December 25, 2012

Merry Christmas

Wish you all Peaceful & Joyful Christmas !!!

Sunday, December 9, 2012

How to Insert Data in Text file to SQL Database



Problem:
Insert large amount of data in text file to a SQL database table with minimum time.
 
Solution:
Using ‘Bulk Insert’ is the solution.

I had to import large amount of data in text file to SQL database. If I programmatically insert this data, it would take more time and memory. Therefore, I use SQL bulk insert to import this data. If the fields in the data files are separated using a special character (comma – ‘,’) they can be directly insert in to columns in the database with one query. In addition, it can be fields are not separated, but have known lengths. Then you have to substring them according to lengths.