Get linked tables and procs

  • Hello,

    What is the best way to find all objects that use a table?  Something like sp_objectdep but better.

  • My "old school" method is search all databases for a character string among objects (SPs, Views...)

    exec sp_MSforeachdb 'use [?] select ''?'' as dbName, name as ''SP_Name'', obj.type,
            substring(definition,CHARINDEX(''MySearchString '', definition)-45,150) as ''Code_Snippet''
    from sys.sql_modules com
    join sysobjects obj on com.object_id = obj.id
    where (definition like ''%MySearchString%'')
    order by dbName, name'

    Tables can also be "hardcoded" in Scheduled Jobs. I highlight all the jobs at once in "Object Explorer", and script them to a new query window, then use "find" to look for object name (table, sp...)

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply