dcsimg
 

Submitted by: Hannes du Preez(ojdupreez1978@gmail.com)

Wednesday Apr 15th 2020 by Hannes du Preez

Language: SQL, Expertise: Intermediate: Choose one of these three SQL queries that will return all the database objects that depend on it.

Any one of these three queries will return all the database objects that depend on it.

sp_depends 'dbo.TableName'

SELECT *
FROM information_schema.routines ISR
WHERE CHARINDEX('dbo.TableName', ISR.ROUTINE_DEFINITION) > 0

SELECT
referencing_schema_name, referencing_entity_name,
referencing_class_desc, is_caller_dependent
FROM sys.dm_sql_referencing_entities ('dbo.TableName', 'OBJECT')
Home
Mobile Site | Full Site