Do I have a requirement to get all database table names that are used in a particular stored procedure?
As an example , I have one stored procedure as shown below.
CREATE PROCEDURE [dbo].[my_sp_Name] @ID INT = NULL AS BEGIN SELECT ID, NAME, PRICE FROM tbl1 INNER JOIN tbl2 ON tbl1.ProductId = tbl2.ProductId LEFT JOIN tbl3 ON tbl2.ProductSalesDate = tbl3.ProductSalesDate LEFT JOIN tbl4 ON tbl1.ProductCode = tbl4.ItemCode END
Expected Result:
Used_Table_Name
Can anyone suggest a way?
source share