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.
CREATE VIEW ClientsInfo
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
This view shows all database objects and dependencies between parent and child objects such as constraints and triggers. Additional info can be found in MSDN
- INFORMATION_SCHEMA views
There are 20 views that can obtain various information about database metadata from different angles. Full list is in MSDN
- 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