[英]How to drop a table with foreign key constraint in SQL Server
I would like to drop a table with foreign key constraint and re-create the same table (with all the relationships) and with additional data (which I have from “Generate Scripts…”)我想删除一个带有外键约束的表并重新创建同一个表(包含所有关系)和附加数据(我从“生成脚本...”中获得)
How can I do it?我该怎么做? I'm using an Azure SQL Server.
我正在使用 Azure SQL Server。
If I disable the constraint, truncate the table, insert new data, and re-enable it?如果我禁用约束,截断表,插入新数据,然后重新启用它? Will this work?
这会起作用吗?
Any leads, please?请问有什么线索吗? Thanks.
谢谢。
One of the ways is to create a .sqlproj
.其中一种方法是创建一个
.sqlproj
。 Inside this, you can create the tables, stored procedures, indexes, data population, and much more.在其中,您可以创建表、存储过程、索引、数据填充等等。 The deployment from
.sqlproj
will take care of any changes you do to the data store. .sqlproj
的部署将处理您对数据存储所做的任何更改。 Please refer to the links below.请参考以下链接。
URL: https://docs.microsoft.com/en-us/azure/devops/pipelines/targets/azure-sqldb?view=azure-devops&tabs=yaml网址: https : //docs.microsoft.com/en-us/azure/devops/pipelines/targets/azure-sqldb?view=azure-devops&tabs=yaml
https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt?view=sql-server-ver15 https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt?view=sql-server-ver15
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.