Bulk import in SQL Server 2008 from CSV file
First a create table in Sql server CREATE TABLE BulkImport
(
ID INT,
Col1 VARCHAR(40),
Col2 VARCHAR(40))
Next Create a CSV file and save as BulkImportTest.csv in your D: drive
1,Row1Col1,Row1Col2
2,Row2Col1,Row2Col2
3,Row3Col1,Row3Col2
4,Row4Col1,Row4Col2
5,Row5Col1,Row5Col2
6,Row6Col1,Row6Col2
copy following query with change path where your file is saved..
BULK
INSERT BulkImport
FROM 'D:\BulkImportTest.csv'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)
now check the imported data...
select * from BulkImport