our company is planning to administer the report server database and the requirement is to get the list of the tables used in stored-procedures in the productions server database.Is there any query/function to retrieve this information ?
Sql-server – Get the list of tables used in a stored-procedure for a database
sql serversql-server-2016stored-procedures
Related Question
- SQL Server Performance – Considerations for Stored Procedures in Separate Database
- SQL Server – Find All Tables Used by Stored Procedure and All SPs Using a Particular Table
- SQL Server – Script to List Stored Procedures in All Databases
- Sql-server – How to get the list of tables in all the stored procedure
- SQL Server – How to List Stored Procedures with INSERTs Without Column Names
- T-sql – Way to obtain full list of column dependencies for stored procedure
- Sql-server – Are stored procedure query texts stored in any tables
Best Answer
If you use dynamic SQL to construct table names (or accept them as arguments), or use nested views, it becomes very difficult to automate this. However if you stick to traditional T-SQL and proper references you can get there with this:
And if you just want a catalog of all references, you can do this: