Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2003
    Posts
    223

    Unanswered: How to check which tables were called?

    Hello everyone:

    I have some nightly jobs that execute stored procedure to call the tables? I want to know which table are called by these stored procedures. Is it possible? Any idea will be appreciated.

    Thanks

    ZYT

  2. #2
    Join Date
    Oct 2005
    Posts
    183
    Lemme get this right, you have a series of stored procedures that run every night, but want a list of the affected tables? basically a listing of the tables in those stored procedures run at night?

    Basically, in stead of reading through the SP's and noting the tables used, you want an automation process?

  3. #3
    Join Date
    Mar 2003
    Posts
    223
    Yes, I need a table list that are affected in the nightly job/

  4. #4
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Just do sp_depends on all of the stored procedures

    Code:
    USE Northwind
    GO
    
    CREATE PROC mySproc99
    AS
    SELECT * FROM Orders
    GO
    
    EXEC sp_depends mySproc99
    GO
    
    DROP PROC mySproc99
    GO
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  5. #5
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    ...although be aware that this will not show tables referenced in dynamic SQL statements embedded in your procedures.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  6. #6
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    True..and if the tables was dropped and recreated it won't show as well..

    How about adding some triggers
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •