为什么“查看依赖关系”会这样?不显示两个数据库上的表之间的外键?
我在 SQL Server Management Studio 2005 中发生了一些小但非常奇怪的事情。我有 2 个数据库目录,它们本质上是相同的。有一个 Market 表,其中包含其他几个表的外键,例如“Project”表有一个 MarketID 列,其中包含来自 dbo.Market 的 FK 引用。在两个数据库目录中,MarketID 不为空,数据类型相同(int - 显然),并且在两个数据库目录中,在两个表之间创建了一个外键(从 dbo.Market 到 dbo.Project)。
在 PRD 目录上,如果我右键单击 Market 表并从上下文菜单中选择“查看依赖关系”,我将看到 MarketId 是其他表上的外键的表(例如 dbo.Project 将出现在“依赖于 Market 的对象”下) )。如果我在其他数据库目录(TST)上执行相同的操作,它不会显示有任何外键。 PRD 和 TST 目录托管在同一数据库服务器上,因此不是一个目录具有不同版本或 SS Management Studio SP 之类的情况......这会带来什么?
更奇怪的是,如果我在两个目录上创建数据库图表,则所有比较表的外键看起来都相同,但“查看依赖关系”的行为不同。如果我查看每个目录上表格的“索引”和“统计”,它们基本上也相同......我很困惑。
任何人都可以建议什么事情会影响当您选择“查看依赖关系”时显示的树中外键关系的可见性
最初我们认为谁删除了外键,但是当我们查看数据图或外键文件夹时他们在那里……
I have something minor, yet very odd happening in SQL Server Management Studio 2005. I have 2 database catalogs which are essentially identical. There is a Market table with a foreign key to other several other tables for example the "Project" table has a MarketID column with an FK reference from dbo.Market. in both db catalogs the MarketID is not null, the datatype is the same (int - obviously) and in both db catalogs there is a foreign key created between the two tables (from dbo.Market to dbo.Project).
on the PRD catalog if I right click the Market table and choose "View Dependencies" from the context menu I will see the tables where MarketId is a foreign key on other tables (e.g. dbo.Project will appear under "Objects that depend upon Market"). If I do the same thing on the other db catalog (TST) it does not show that there are any foreign keys. PRD and TST catalogs are hosted on the same db server, so it's not a case of one catalog has a different version or SP of SS Management Studio or something... what gives?
What is even more strange is if I create a database diagram on both catalogs, the foreign keys look the same for all the tables compared, but the behaviour of the "View Dependencies" is different. If I look at the "Indexes" and "Statistics" for the tables on each catalog they are essentially identical too... I am baffled.
Can anyone suggest what things would impact the visibility of foreign key relationships in the tree that is shown when you choose the "View Dependencies"
Initially we thought wtf who removed the foreign keys, but when we look at a data diagram or the foreign keys folder they are there...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是 SSMS 使用的 SQL Profiler 脚本。我想这只是一个运行它来看看两个数据库之间有什么不同的问题。
From SQL Profiler this is the script SSMS uses. I guess it's just a question of running it your end to see what's different between the two databases.