I work with SQL Server 2008 and I have a database that has more than 1500 columns and about 500 stored procedures and ... .
I want to rename a table that has several relations and is referenced in many stored procedure and views and ... .
How to I can get all Items in database that has a relation with this table?
Thanks.
Using sys.dm_sql_referencing_entities
:
SELECT
referencing_schema_name, referencing_entity_name, referencing_id,
referencing_class_desc, is_caller_dependent
FROM
sys.dm_sql_referencing_entities ('mySchemaName.myTableName', 'OBJECT');
GO
where 'mySchemaName.myTableName'
is your schema.table, for example 'dbo.MyTable'