Check for all database objects that depend on the table. If the table is to be dropped, the dependency objects will need to be dropped as well.

SELECT referencing_id, 
       referencing_schema_name, 
       referencing_entity_name 
FROM sys.dm_sql_referencing_entities('dbo.tbTable', 'OBJECT');
SELECT referenced_schema_name, 
       referenced_entity_name, 
       name, 
       type_desc, 
       create_date 
FROM sys.sql_expression_dependencies A, sys.objects B
WHERE referenced_id = OBJECT_ID(N'dbo.tbTable') AND 
	A.referencing_id = B.object_id  
EXEC sp_depends @objname = N'dbo.tbTable'
Last modified: May 7, 2019

Author

Comments

Write a Reply or Comment