The name of tables and views in a stored procedure in sql server 2005

I have a stored procedure, I want to know the name of the tables and views used in this stored procedure, can anyone suggest how I can do this.

Thanks in advance.

+5
source share
3 answers

You can use sp_depends, but it depends on the current dependency information.

Running sp_refreshsqlmodulefor all objects in the database can update it if there is any dependency information.

+5
source
select
so.name,
sc.text
from
sysobjects so
inner join syscomments sc on so.id = sc.id
where
sc.text like '%ROLES%'-- name of the table 

Find the Sp database associated with (using) table XXX

+1
source

All Articles