[英]ssdt dacpac: how to prevent dacpac to generate the error when dropping columns in a table with data
I am dropping a column in a table xxx
with data.我正在删除带有数据的表xxx
一列。 The DACPAC is generating the checking as follow. DACPAC 正在生成如下检查。
IF EXISTS (select top 1 1 from [dbo].[xxx])
RAISERROR (N'Rows were detected. The schema update is terminating because data loss might occur.', 16, 127) WITH NOWAIT
All the data migration has been done in pre-deployment script.所有的数据迁移都在预部署脚本中完成。 Currently I have comment it out manually.目前我已经手动注释掉了。
How to prevent it from auto generating?如何防止它自动生成?
Uncheck Block incremental deployment if data loss might occurred
in VS\\Publish\\Advanced\\General. Block incremental deployment if data loss might occurred
VS\\Publish\\Advanced\\General 中Block incremental deployment if data loss might occurred
取消选中Block incremental deployment if data loss might occurred
。
对于那些使用 sqlpackage 部署 dacpac 或使用 Azure devops 的人,请在附加参数中设置以下内容,它应该可以工作。
/p:BlockOnPossibleDataLoss=False
this is most likely due to a dependency like a trigger.这很可能是由于像触发器这样的依赖关系。
If you aren't sure what object is causing it, you can use the following script to identify如果您不确定是什么对象导致它,您可以使用以下脚本来识别
select * from sys.objects
where Object_id = (OBJECT_ID('<name of object blocking'))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.