I am trying to import a CSV file in SQL Server 2008.
BULK INSERT is a way to go but it is applicable for CSV from SQL Server 2014 onwards.
What would be an alternative way to achieve this goal?
Any thoughts/ideas much appreciated.
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It only takes a minute to sign up.Sign up to join this community
SQL Server has always supported bulk inserting from CSV files, you just have to specify field/row terminators.
Then we do this:
CREATE TABLE #foo(a varchar(32), b varchar(32), c int); BULK INSERT #foo FROM 'c:\temp\file.csv' WITH (ROWTERMINATOR = '\n', FIELDTERMINATOR = ','); SELECT * FROM #foo;
a b c -------- -------- ---- foo bar 1 blat splunge 2
If you problem then next link follow I hope solve your problem