When I need to analyze dependencies, I should find the answer for 2 questions:
1) which objects does my piece of code depends on? In this case, I get the impact from the others.
When you look at this view definition, you understand that the view depends on two tables.
1 2 3 4 5 |
CREATE VIEW ClientsInfo AS SELECT c.ClientName, p.PhoneNumber FROM Clients c JOIN PhoneNumbers p ON c.ClientGuid = p.ClientGuid; |
2) which objects does my piece of code influence on? Now I produce the impact to others.
Microsoft SQL Server has some capabilities to analyze dependencies.
- catalog view sys.objects
- INFORMATION_SCHEMA views
- system stored procedure sp_depends
According to information in MSDN, this stored procedure will be removed in the future.
- dynamic managements functions sys.dm_sql_referenced_entities and sys.dm_sql_referencing_entities