I have a data.csv file, which contains the following data. I will explain, how to insert this data into a data table.
If any row contains wrong data, the data will not insert, else the data of a row will insert into the table. Column sequence and structure must be same in both CSV and data table.
Syntax
  1. BULK INSERT Table_Name
  2. FROM 'file_path' -- F:/data.csv
  3. WITH
  4. (
  5. FIELDTERMINATOR = ',',
  6. ROWTERMINATOR = '\n'
  7. )
  8. GO
Example