[英]Database Diagram not showing table relation when new foreign key reference is added in SSMS 20114
I have three tables as follows - 我有三个表,如下所示:
But when I add the foreign key reference, the relation is ( a straight line in the Database Diagram) not shown . 但是,当我添加外键引用时,该关系为(数据库图中的一条直线)未显示 。
Following is the reference I wrote. 以下是我写的参考。
ALTER TABLE [dbo].EmployeeDesignation
ADD CONSTRAINT FK_EmployeeDesignation_Employee FOREIGN KEY (EmployeeId)
REFERENCES Employee (EmployeeId)
ON DELETE CASCADE
ON UPDATE CASCADE
;
ALTER TABLE [dbo].[EmployeeDesignation]
ADD CONSTRAINT FK_EmployeeDesignation_Designation FOREIGN KEY (DesignationId)
REFERENCES Designation (DesignationId)
ON DELETE CASCADE
ON UPDATE CASCADE
;
In addition, When I add another two tables ( Department and EmployeeDepartment
) I can see the relation in the diagram 另外,当我添加另外两个表( Department and EmployeeDepartment
)时,我可以在图中看到关系
The code for the reference is as follows -- 供参考的代码如下-
ALTER TABLE [dbo].EmployeeDepartment
ADD CONSTRAINT FK_EmployeeDepartment_Department FOREIGN KEY (DepartmentId)
REFERENCES Department (DepartmentId)
ON DELETE CASCADE
ON UPDATE CASCADE
;
ALTER TABLE [dbo].EmployeeDepartment
ADD CONSTRAINT FK_EmployeeDepartment_Employee FOREIGN KEY (EmployeeId)
REFERENCES Employee (EmployeeId)
ON DELETE CASCADE
ON UPDATE CASCADE
;
What might be the reason That the later one showing relation line while the previous one is not showing? 后面的一个未显示关系线而前一个未显示关系线的原因可能是什么? Am I missing something? 我想念什么吗?
Thanks ! 谢谢 !
Try closing SSMS and then reopening it again. 尝试关闭SSMS,然后再次将其重新打开。 Seems like the cache used by SSMS for some of functionality is not refreshed even upon closing and re-opening the database connection. 似乎SSMS用于某些功能的缓存即使在关闭并重新打开数据库连接后也不会刷新。 check https://stackoverflow.com/a/4316415/364084 检查https://stackoverflow.com/a/4316415/364084
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.