Tuesday, August 14, 2012

sql server dependent objects cross database

a new system table sys.sql_expression_dependencies , very helpful in find the objects referring in other databases.

use <databasename>

SELECT OBJECT_NAME (referencing_id),referenced_database_name,
    referenced_schema_name, referenced_entity_name
FROM sys.sql_expression_dependencies
WHERE referenced_database_name IS NOT NULL
order by 2

No comments:

Post a Comment

Featured Post

SQL Server AWS Migration BCP

stored procedure to generate BCP scritps to migrate the SQL Server database. Developed this stored procedure on my labs to simulate t...

Contributors