Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

sp to object dependencies Expand / Collapse
Author
Message
Posted Wednesday, June 10, 2009 1:27 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, April 03, 2014 10:39 AM
Points: 34, Visits: 157
Hi All,

Can abyone help me to create a script that will tell me what all object (table,views) are dependent on a particular stored procedure.


Thanks in advance
Post #732064
Posted Wednesday, June 10, 2009 4:31 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Thursday, December 06, 2012 8:30 AM
Points: 879, Visits: 810
You use sp_depends 'ObjectName'. This will get you all dependancies
If you wish to tailor the output to your specific needs place it in a (temporary) table.

Mind, there are other ways to find dependencies, not all dependencies can be found like above. Have a read:
http://www.mssqltips.com/tip.asp?tip=1294



Greetz,
Hans Brouwer
Post #732123
Posted Wednesday, June 10, 2009 4:47 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, April 03, 2014 10:39 AM
Points: 34, Visits: 157
Hi Hans,

thanks for update.

its not working in my database .it is not returning anything after giving the sp name.

Regards
Amit
Post #732128
Posted Wednesday, June 10, 2009 6:52 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Thursday, December 06, 2012 8:30 AM
Points: 879, Visits: 810
It could be you have to qualify the object if schema is NOT dbo.
Supposing you have the Adventureworks db attached, you should get results with this:

exec sp_depends 'person.contact'

If not, then I don't know what could be wrong; if you do, then this sp works and it may mean your object has no dependencies.



Greetz,
Hans Brouwer
Post #732204
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse