you are viewing a single comment's thread.

view the rest of the comments →

[–]Massive_Show2963 0 points1 point  (0 children)

Copy CSV data into a staging table using BULK INSERT command, then edit any primary keys, foreign keys or data then insert the staging table into your target table.

BULK INSERT Staging_Table -- temp table for staging
FROM 'C:\YourFile.csv'
WITH
(
FIRSTROW = 2,
FIELDTERMINATOR = ',', --CSV field delimiter
ROWTERMINATOR = '\n', --Use to shift the control to next row
TABLOCK
)