|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Tuesday, March 19, 2013 1:59 PM
Points: 34,
Visits: 149
|
|
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
|
|
|
|
|
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
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Tuesday, March 19, 2013 1:59 PM
Points: 34,
Visits: 149
|
|
Hi Hans,
thanks for update.
its not working in my database .it is not returning anything after giving the sp name.
Regards Amit
|
|
|
|
|
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
|
|
|
|