In SQL Server 2008, for a view in a given database, I can get the tables in other databases on which the view depends by executing:
select distinct referenced_database_name, referenced_schema_name, referenced_entity_name
from sys.dm_sql_referenced_entities ('dbo.NameOfView', 'OBJECT')
where referenced_database_name is not null
However, sys.dm_sql_referenced_entities is not available in SQL Server 2005. Is there a way to obtain, from the metadata, a list of tables in other databases on which a view depends?
From Aaron Bertrand’s vaguely related blog entry:
He goes on to recommend a parser from here – but it’s still a nasty job on 2005 I’m afraid.