Tables used by your SP

  • Hi All,

    Any idea on this?

    I need to have a list of tables used by my SP.

    Anyone have script that return you the list of tables or articles that will be helpful in retrieving the tables?

    Thanks.

    Renan

  • Try out this one.

    sp_depends yourprocname

    or

    use sysdepends table.

    karthik

  • Thanks karthikeyan ,

    i tried sp_depends and it returned list of table and Columns of retrieved table. but the list of table seems incomplete.

    does sp_depends return only those tables used that is in the same database? we have stored proc's that are using tables from another db(but on the same server), but it is not returned using sp_depends.

    please advise.

    - renan

  • Unfortunately sp_depends and sysdepends are unreliable as SQL Server will allow you to create a stored procedure that references a non-existent table so the dependency is not created in sysdepends.

    Jack Corbett
    Consultant - Straight Path Solutions
    Check out these links on how to get faster and more accurate answers:
    Forum Etiquette: How to post data/code on a forum to get the best help
    Need an Answer? Actually, No ... You Need a Question

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

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