Tuesday, December 25, 2012

How to import to data in TEXT to SQL Sever

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,
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.

Merry Christmas