Import first 1000 records to sql server from csv file

I need to import a csv file into a sql server table, but I want to import the first 1000 entries of a csv file.

This is my sql code,

USE MyDB
BULK INSERT MyTable
FROM 'C:\Users\jasons\Desktop\Documents\MyFile.csv'
WITH(
FIRSTROW = 2,
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)

What do I need to add or how can I change my code to import the first 1000 records.

+4
source share
1 answer
USE MyDB
BULK INSERT MyTable
FROM 'C:\Users\jasons\Desktop\Documents\MyFile.csv'
WITH(
FIRSTROW = 2,
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n',
LASTROW = 1001
)
+6
source

All Articles