How to find out what Stored Procedures are used for a table

  • I have a table and I have many SPs where the table is used in many ways. Insert, Update, etc. Is there any way to find this out? If yes, how?

  • This works GREAT !!!

    http://sqldigger.bdsweb.be/

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg
  • I have SS 2005.

  • It works with 2005

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg
  • If just the tools supplied by SQL Server, sp_depends or sys.sql_dependencies, are not enough, you migh also want to consider looking at Red Gate's SQL Dependency Tracker

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Works great. Thx.

    BTW, Is something similar available for Visual Studio? Say I want to modify a DLL. But before I do that, I want to find out where the DLL is being used.

  • I don't have a clue. Would the ANTS Profiler from Red Gate work?

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Don't think so. I looked at it. It doesn't do the job. I have asked them if they have something similar to Dependency Tracker for Visual Studio.

  • If I understood the question right I will give you the no no approach I use all the time....

    You can search the syscomments tables text value for the name of the table you are looking for...

    use [DATABASENAME]

    go

    select so.name from sysobjects so join syscomments sc

    on so.id=so.id

    where sc.text like '%[TABLENAME]%'

    and so.xtype = 'P'

    and name not like 'dt_%'

    and name not like 'sp_%'

    Is this what you are looking for?

  • Vescogni (11/16/2007)


    If I understood the question right I will give you the no no approach I use all the time....

    You can search the syscomments tables text value for the name of the table you are looking for...

    use [DATABASENAME]

    go

    select so.name from sysobjects so join syscomments sc

    on so.id=so.id

    where sc.text like '%[TABLENAME]%'

    and so.xtype = 'P'

    and name not like 'dt_%'

    and name not like 'sp_%'

    Is this what you are looking for?

    This is the approach I often use because it doesn't require any 3rd party tools and produces an answer quickly. You may have to weed through some false positives, but in general it is effective.

    Now, if you're trying to map all of the dependencies in the database, I would typically start looking at the tools.

    K. Brian Kelley
    @kbriankelley

  • cool. thx guys.

Viewing 11 posts - 1 through 10 (of 10 total)

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