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 2008 Forums
 Transact-SQL (2008)
 Need help to find script of all SPs, ect relates t

Author  Topic 

NguyenL71
Posting Yak Master

228 Posts

Posted - 2010-10-18 : 18:14:04
Hi,

I need to find all the SPs, Views, Triggers, and UDF associate with a table. Does anyone
knows where I can such scripts. I have about 30 tables need to query out. The reason I am
doing this is because I just change the datatype of CustNumber from nvarchar(50) to varchar(10)
and need to change all the procs, ect.. relates to the tables.

SQL 2008.

Thank you in advance.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-10-18 : 18:43:22
Check out the syscomments table.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-10-19 : 13:28:02
you can get object dependency of table by using sp_depends stored procedure. but keep in mind this wont return ones where table is used inside dynamic sql.
however, If your attempt is to find column usage you need to use query like below


select OBJECT_NAME(object_id) AS Module_Name,definition from sys.sql_modules where definition LIKE '%CustNumber%'


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -