Pages

Saturday, January 19, 2008

Import CSV file into SQL Sever

I am getting quite few queries from my friends and also from various forums on importing the data into SQL Server from csv file.

Use the below query.

SELECT *
INTO theEMPImportTable
FROM
OPENROWSET('MSDASQL',
'Driver={Microsoft Text Driver (*.txt; *.csv)};
DEFAULTDIR=D:\;Extensions=CSV;',
'SELECT * FROM CSVEmployeeFile.csv')

1 comment:

Anonymous said...

I like your blog.
Your code is so simple in importing CSV file into SQL Server