sp to object dependencies

  • 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

  • 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

  • Hi Hans,

    thanks for update.

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

    Regards

    Amit

  • 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