View Dependencies
View Dependencies is a SQL statement in the Views category. SQL Server: finds all objects (views, procedures) that depend on a given table or view. The syntax is SELECT * FROM sys.dm_sql_referencing_entities('dbo.employees', 'OBJECT');. It returns dependency information. A typical example: -- Find objects referencing the employees table: SELECT referencing_schema_name, referencing_entity_name, referencing_class_desc FROM sys.dm_sql_referencing_entities('dbo.employees', 'OBJECT'); -- Find what an object depends on: SELECT referenced_entity_name, referenced_minor_name FROM sys.dm_sql_referenced_entities('dbo.vw_employee_details', 'OBJECT'); -- Useful before ALTER/DROP operations: -- Shows which views will break A close relative is CREATE VIEW, which creates a virtual table based on a SELECT query. Think of it as a saved query that acts like a table. A close relative is DROP VIEW, which removes a view from the database. Does not affect the underlying tables. A close relative is ALTER VIEW, which modifies an existing view definition. More about this category: Database views — CREATE VIEW, DROP VIEW, ALTER VIEW, materialized views.