Microsoft SQL Server foreign key dependencies show up using sp_MSdependencies but are not listed in sys.foreign_keys

最后都变了- 提交于 2021-01-29 06:21:04

问题


I have a table that when I click view dependencies, it shows less related tables than if I run the following T-SQL

EXEC sp_MSdependencies N'Item.Item', null, 1315327 

There are three dependencies for three different tables that don't show up in the GUI. This wouldn't really be an issue for me but EFCorePowerTools is also not mapping those dependencies. So my question is - does anyone know what the Microsoft SSMS tool is using to visually show the dependencies when you right click and choose view dependencies? I need to figure out how some of my relationships are different than others. I made them all the same way and have tried removing and re-adding the ones in question. Recreating them makes no difference and they still don't show up. Any help is appreciated.

Update Thanks to someone from EFCorePowerTools, I have learned that Entity Framework Core is using sys.foreign_keys for the definition. When I query that table, I can't see anything that helps.

Image of Gui:

Image of EXEC sp_MSdependencies N'Item.Item', null, 1315327


回答1:


Here is what ssms does, when you click on view dependencies: https://www.mssqltips.com/tipimages/1294_sqlcode.txt

The other method, you can use to view dependencies by using INFORMATION_SCHEMA.ROUTINES or syscomments.

Tool which can help you to view dependencies is https://www.red-gate.com/products/sql-development/sql-dependency-tracker/



来源:https://stackoverflow.com/questions/53675738/microsoft-sql-server-foreign-key-dependencies-show-up-using-sp-msdependencies-bu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!