[英]About insert identity column
I need to merge some data (include identity column) from other server to my server without interrupting my service running. 我需要将其他服务器中的某些数据(包括身份列)合并到我的服务器中,而不会中断我的服务的运行。 I export the data from the other server and insert into to my server like this:
我从另一台服务器导出数据,然后将其插入到我的服务器中,如下所示:
SET IDENTITY_INSERT tbl_content ON
... insert command ...
SET IDENTITY_INSERT tbl_content OFF
However, if I set the IDENTITY_INSERT
on, other applications inserting data into the database without identity column will get an error 但是,如果我将
IDENTITY_INSERT
设置为on,则其他将数据插入到没有标识列的数据库中的其他应用程序将收到错误消息
Explicit value must be specified for identity column in table '....' either when IDENTITY_INSERT is set to ON
当IDENTITY_INSERT设置为ON时,必须为表'....'中的标识列指定显式值
How can I insert identity column without interrupting other applications? 如何在不中断其他应用程序的情况下插入标识列?
Why not use SqlTransaction
when performing the bulk insert. 为什么在执行批量插入时不使用
SqlTransaction
。 Yes your table will be locked for some time but atleast you'll guarantee data integrity. 是的,您的表将被锁定一段时间,但至少可以保证数据的完整性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.