sql server:如何使用“批量加载csv文件”每个领域都有配额吗?
我有一个管道分隔的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,您需要一个格式文件来处理不同的列分隔符
"
然后"|"
然后"|"
..."
。默认情况下,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
几年前我遇到了同样的问题,但从未找到批量插入忽略它的方法。经过大约一个小时的研究后,我决定要求我们的客户重新导出不带引号的文件。十五分钟后,我就可以开始跑步了。我很想知道是否真的有办法实现这一点,但批量插入功能似乎总是相当不灵活,所以我决定不花太多时间在上面。
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.