Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Query to find procedures/views built on a table

Author  Topic 

venkath
Posting Yak Master

202 Posts

Posted - 2009-04-13 : 21:33:46
Hi All

Is there way I can find procedures or views that are using a particular table?

In other words, I need to get all the procedures, views that are built on a table.

Help on this is greatly appreciated..

Thanks

toddbkc
Starting Member

9 Posts

Posted - 2009-04-14 : 10:54:41
Yes - there is a way!!!

This is the "Old" syntax, but still works...

select distinct o.name from syscomments c INNER JOIN sysobjects o
ON c.id = o.id
where c.text like '%table1%'

You can also get fancy and filter the object types if you want - for example, if you only want stored procedures that contain that value, add "AND o.type = 'P'"

Hope this helps!

TODD
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-04-15 : 03:12:39

EXEC sp_depends 'table_name'

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -