简体   繁体   English

Rowversion 字段导致 BULK INSERT 仅每隔一行导入

[英]Rowversion field causes BULK INSERT to only import every other row

When I perform a BULK INSERT into a table with a rowversion field, only every other row gets imported.当我对带有 rowversion 字段的表执行 BULK INSERT 时,只会导入每隔一行。

Here's my source text file:这是我的源文本文件:

在此处输入图片说明

If I perform a BULK INSERT into a table with a rowversion field, only two rows are imported:如果我对具有 rowversion 字段的表执行 BULK INSERT,则仅导入两行:

在此处输入图片说明

However, if I do the exact same thing but comment out the rowversion field, all four rows are imported:但是,如果我执行完全相同的操作但注释掉 rowversion 字段,则会导入所有四行:

在此处输入图片说明

Is this a bug in SQL Server?这是 SQL Server 中的错误吗? Am I doing something wrong?难道我做错了什么? Is there a way to BULK INSERT into tables with rowversion columns?有没有办法 BULK INSERT 到带有 rowversion 列的表中?

I found one workaround , but it will require creating and dropping a view to do the bulk insert.我找到了一种解决方法,但它需要创建和删除视图来执行批量插入。 It's not a huge deal in my case, since I'm automating the whole process anyway, but I'd still like to know if there is some way to better deal with this without having to create a temporary database object to do it.在我的情况下这不是什么大问题,因为无论如何我都在自动化整个过程,但我仍然想知道是否有某种方法可以更好地处理这个而不必创建临时数据库对象来做到这一点。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM