Friday, September 28, 2012

SQL to get the names of the tables referenced in stored procedures

below is a simple sql to retrieve a list of all the stored procedures and the tables referenced in those procedures:

SELECT DISTINCT AS [Procedure Name], AS [Table Name]
FROM sysobjects as a
INNER JOIN sysdepends d ON
INNER JOIN sysobjects b ON
WHERE a.xtype = 'P'

No comments:

Post a Comment