dcsimg
LinkedIn
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: SQL
Expertise: Intermediate
Apr 15, 2020

Finding Object Dependencies in SQL

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')
Hannes du Preez
 
Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date