[英]Import first 1000 records into sql server from a csv file
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. 我需要将csv文件导入sql server表,但我只想导入csv文件的前1000条记录。
This is my sql code, 这是我的sql代码,
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. 我需要添加什么或如何更改我的代码只导入前1000条记录。
USE MyDB
BULK INSERT MyTable
FROM 'C:\Users\jasons\Desktop\Documents\MyFile.csv'
WITH(
FIRSTROW = 2,
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n',
LASTROW = 1001
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.