Is it possible to find all tables that has a join with 'tMyTable'

  • I need to find all tables which has a join (either inside an sp, view, etc)

    with my given table in a db.

    sys.dm_sql_referencing_entities doesnt help here.

    Note: i dont want to identify by FK References, for 2 reasons:

    1) tables might not met with a join (just FK was defined)

    2) sometimes, a join happened between tables, without an FK defined

    Always appreciating your helps.

    -Muhamed

  • This isn't 100% accurate, but it will get you close

    select object_name(object_id)

    from sys.sql_modules

    where definition like '%mytablename%'

    and definition like '%join%'

    Best,
    Kevin G. Boles
    SQL Server Consultant
    SQL MVP 2007-2012
    TheSQLGuru on googles mail service

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

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