June 10, 2009 at 1:27 am
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
June 10, 2009 at 4:31 am
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
June 10, 2009 at 4:47 am
Hi Hans,
thanks for update.
its not working in my database .it is not returning anything after giving the sp name.
Regards
Amit
June 10, 2009 at 6:52 am
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
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply