List of the tables from Stored procedure

srk 41 Reputation points
2023-08-30T11:50:19.9833333+00:00

Hi there,

I was trying to find list of the tables used in stored procedure as we did use the tables in INSERT, UPDATE, IN JOINS , TRUNCATE as well. I would like to get the list of the tables part of above operations please.

Please let me know.

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,165 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Olaf Helper 45,371 Reputation points
    2023-08-30T11:55:25.68+00:00

  2. Erland Sommarskog 113.7K Reputation points MVP
    2023-08-30T21:56:19.1733333+00:00

    There is no straightforward way to do this - you would need to parse the code.

    But for some ideas of what is available in terms of partial solution, see the short story Where Is that Table Used? on my web site.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.