• PiMané (10/31/2012)


    Hi,

    Just tried the sys.dm_sql_referenced_entities but the dynamic SQL isn't analyzed...

    The following code returns info for the "normal" GetProducts that uses ProductId = COALESCE(@ID, ProductId) AND ... but as you say in a post using dynamic SQL is best for these situations: http://sqlinthewild.co.za/index.php/2009/03/19/catch-all-queries/

    SELECT referenced_schema_name, referenced_entity_name, referenced_minor_name,

    referenced_minor_id, referenced_class_desc

    FROM sys.dm_sql_referenced_entities ('dbo.GetProducts2', 'OBJECT')

    I was just trying a way of getting the dependencies correct but with dynSQL there isn't much chance on doing it... or I just don't know how

    Thanks,

    Pedro

    Did you ever figure out the drawback to your strategy? It seemed to make sense to me. What is the downside?