Friday, 26 June 2015

Import data from csv file to table in via SQL



Import data from csv file to table in via SQL



CREATE TABLE #Demotable(  
 [EmpName] [nvarchar](MAX) NULL,  

 [Email] [nvarchar](MAX) NULL
)


BULK INSERT #Demotable FROM 'C:\demo.csv' WITH (FIELDTERMINATOR = ',',ROWTERMINATOR = ' ')


Make sure csv and table have same fields.