sql server:如何使用“批量加载csv文件”每个领域都有配额吗?

发布于 2024-10-15 03:11:00 字数 139 浏览 7 评论 0原文

我有一个管道分隔的 csv 文件,但每个字段都被引用如下

"111"|"test"|"abc"

现在我使用 powershell 删除所有“,然后在批量插入之前保存它。是否可以只加载它而不删除”?

I have a pipe delimited csv file, but every field was quoted as following

"111"|"test"|"abc"

Now I used powershell to remove all " and then save it before the bulk insert. Is it possible just load it without removing "?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

逐鹿 2024-10-22 03:11:00

是的,您需要一个格式文件来处理不同的列分隔符" 然后 "|" 然后 "|" ... "

默认情况下,bcp 和 BULK INSERT 仅处理一致的分隔符

Yes, you need a format file to deal with different column separators " then "|" then "|" ... ".

By default, bcp and BULK INSERT deal only with consistent separators

请止步禁区 2024-10-22 03:11:00

几年前我遇到了同样的问题,但从未找到批量插入忽略它的方法。经过大约一个小时的研究后,我决定要求我们的客户重新导出不带引号的文件。十五分钟后,我就可以开始跑步了。我很想知道是否真的有办法实现这一点,但批量插入功能似乎总是相当不灵活,所以我决定不花太多时间在上面。

I ran into this same issue a couple years ago and never found a way for the bulk insert to ignore it. After about an hour of researching I decided to just ask our client to re-export the file without the quotes. Fifteen minutes later I was up and running. I'd love to know if there's actually a way to accomplish this, but the bulk-insert feature always seemed rather inflexible so I decided not to burn too much time on it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文