简体   繁体   English

SQL Server中的参照完整性

[英]Referential integrity in SQL Server

Can we set up referential integrity between two databases in SQL Server? 是否可以在SQL Server中的两个数据库之间设置引用完整性? If yes, how can we do this? 如果是,我们该怎么做?

From Microsoft documentation: 从Microsoft文档:
FOREIGN KEY constraints can reference only tables within the same database on the same server. FOREIGN KEY约束只能引用同一服务器上同一数据库中的表。 Cross-database referential integrity must be implemented through triggers. 跨数据库参照完整性必须通过触发器实现。 For more information, see CREATE TRIGGER (Transact-SQL). 有关更多信息,请参见CREATE TRIGGER(Transact-SQL)。
Source: 资源:
Create Foreign Key Relationships 创建外键关系

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

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