SQL中的BULK SQL查询 [英] BULK SQL Query in SQL

查看:196
本文介绍了SQL中的BULK SQL查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,



我正在将CSV数据插入SQL Server。

以下是代码。



Dear,

I'm inserting CSV data into SQL Server.
Below is the code.

BULK
INSERT AA_Temp
FROM 'D:\A\33.csv'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)
GO





我的问题是我的CSV文件有一个标题,没有成功插入标题。



如何跳过第一个标题,我试过上面的代码,但得到第一个标题行的错误类型不匹配beocz。



谢谢

Basit



What my problem is my CSV file has a header, without having header is successfully inserted.

How to skip the first header, i tried above code but got error type mismatch beocz of getting first header row.

Thanks
Basit

推荐答案

BULK
INSERT AA_Temp
FROM 'D:\A\33.csv'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n',
FIRSTROW = 2
)
GO



如何跳过第一行,它很容易使用FIRSTROW = n,其中n是要插入记录的行号,第n行将被视为第一行,阅读更多内容 [ ^ ]



-KR


How to skip first row, it's easy use FIRSTROW = n, where n is the row number from where you want to insert record, nth row will be treated as first row, read more[^]

-KR


这篇关于SQL中的BULK SQL查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆