虽然IDENTITY

编程入门 行业动态 更新时间:2024-10-24 18:26:59
本文介绍了虽然IDENTITY_INSERT设置为ON,但无法为标识列插入显式值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

您好,

我使用CopyData活动将整个表从mySQL数据库复制到Azure SQL Server数据库。现在,在四个表中的两个表中,每次都会收到以下错误,并且不会占用任何行:

I use a CopyData activity to copy entire tables from a mySQL DB to an Azure SQL Server DB. Now in two of four tables I receive the following error every time, and no rows are taken over:

{ "errorCode": "2200", "message": "ErrorCode=FailedDbOperation,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=A database operation failed with the following error: 'Cannot insert explicit value for identity column in table 'artikel' when IDENTITY_INSERT is set to OFF.',Source=,''Type=System.Data.SqlClient.SqlException,Message=Cannot insert explicit value for identity column in table 'artikel' when IDENTITY_INSERT is set to OFF.,Source=.Net SqlClient Data Provider,SqlErrorNumber=544,Class=16,ErrorCode=-2146232060,State=1,Errors=[{Class=16,Number=544,State=1,Message=Cannot insert explicit value for identity column in table 'artikel' when IDENTITY_INSERT is set to OFF.,},],'", "failureType": "UserError", "target": "CopyData" }

我已在预拷贝脚本中的TRUNCATE之后添加了RESEED和SET IDENTITY_INSERT:

I already added a RESEED and SET IDENTITY_INSERT ON after the TRUNCATE in the precopy script:

TRUNCATE TABLE [@{item().TABLE_SCHEMA}].[@{item().TABLE_NAME}]; DBCC CHECKIDENT ('[@{item().TABLE_SCHEMA}].[@{item().TABLE_NAME}]', RESEED, 1); SET IDENTITY_INSERT [@{item().TABLE_SCHEMA}].[@{item().TABLE_NAME}] ON;

但错误仍然存​​在。我还能做些什么?

However the error still remains. What can I do further?

推荐答案

你可以尝试做 RESEED并在TRUNCATE操作后设置IDENTITY_INSERT ON存储过程活动。

请试一试,告诉我们是否有帮助。另外,我们可以继续深入研究。

更多推荐

虽然IDENTITY

本文发布于:2023-11-16 01:33:07,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1599783.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:IDENTITY

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!