This is very common request recently – How to import CSV file into SQL Server? How to load CSV file into SQL Server Database Table? How to load comma delimited file into SQL Server? Let us see the solution in quick steps.
CSV stands for Comma Separated Values, sometimes also called Comma Delimited Values.
CREATE TABLE CSVTest
Create CSV file in drive C: with name csvtest.txt with following content. The location of the file is C:\csvtest.txt
Now run following script to load all the data from CSV to database table. If there is any error in any row it will be not inserted but other rows will be inserted.
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
--Check the content of the table.
--Drop the table to clean up database.
DROP TABLE CSVTest
Reference : Pinal Dave (http://blog.SQLAuthority.com)