View linked server dependencies sql server 2008

Peuge picture Peuge · Jun 23, 2011 · Viewed 12.6k times · Source

Does any know how / if it is possible to view all tables/views/stored procedures that depend on a linked server in Sql Server 2008. Basically as if the context menu "View dependencies" was accessible for linked servers?

Any help much appreciated.

Thanks

Answer

gbn picture gbn · Jun 23, 2011

Search for it

SELECT OBJECT_NAME(object_id), *
FROM sys.sql_modules
WHERE definition LIKE '%myLinkedServer%'

Or use the free Red gate SQL Search to do the same with a GUI

There is no table or feature that tracks dependencies between the server-level linked server objects and database-level objects

Note: INFORMATION_SCHEMA views and the legacy syscomments truncate the definition so are unreliable for definition searches.