Bulk insert in SQL Server

dmitry picture dmitry · Jan 23, 2014 · Viewed 7.3k times · Source

I have created SSIS package that imports data to my table from csv, I am trying to reproduce SSIS via sql command, more specifically, with bulk insert statement, could you help?

csv file properties:

enter image description here

enter image description here

Answer

Kiril Rusev picture Kiril Rusev · Jan 23, 2014

You can use Bulk Insert for the purpose:

BULK INSERT table_name
FROM 'c:\test.csv'
WITH
(
   FIRSTROW= 3,
   FIELDTERMINATOR = ';',
   ROWTERMINATOR = '\n'
)