Query to find dependencies for a stored procedure

  • Hi,

    I'm seeing more dependencies from SSMS but getting only few with below query that I'm using:

    DECLARE @sp nvarchar(100)
    SET @sp = N'dbo.PostDeploy'


    -- Objects on which the stored procedure @sp depends
    SELECT
    referenced_schema_name,
    referenced_entity_name,
    referenced_minor_name,
    referenced_id,
    referenced_minor_id,
    referenced_class,
    referenced_class_desc
    FROM
    sys.dm_sql_referenced_entities(@sp, 'OBJECT')

    Can you please provide correct script to find all dependencies for a Stored procedure?

  • SSMS is doing a recursive search.  I like Redgate's SQL Dependency Tracker.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

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

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