Import first 1000 records into sql server from a c

2019-06-24 07:45发布

I need to import a csv file into sql server table, but i only want to import the first 1000 records of the 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 only import the first 1000 records.

1条回答
霸刀☆藐视天下
2楼-- · 2019-06-24 08:14
USE MyDB
BULK INSERT MyTable
FROM 'C:\Users\jasons\Desktop\Documents\MyFile.csv'
WITH(
FIRSTROW = 2,
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n',
LASTROW = 1001
)
查看更多
登录 后发表回答