Is there a way (or, ideally, a query) to determine all the tables that a stored procedure accesses, including those accessed by other stored procs that it calls itself (and those that they call, etc. down the call stack).
If anyone can fabricate such a query, is it additionally possible to determine whether tables are accessed for update, select or delete?
Is it possible to determine the same where views are thrown into the mix?
My stored procs do not contain any dynamically-constructed calls, so that simplifies it at least slightly.
i've got no access to sql-server at the moment, but i know you can check dependecies - i've done this, determining views accessing tables.
have a look at
sys.all_objects
andsysdepends
. you can join them onobject_id
anddepid
. including thetype
-column ofsysdepends
, you should be able to get the tables, accessed by a SP.will have a look tomorrow, if still neccessary - but you should be able to get your information checking the above infos!
@edit: just saw comment of Aaron. Everything explained right there. Perhaps it was luck to get the right dependencies in my case ;)
Try this Link:
how-to-find-all-dependencies-of-a-table-in-sql-server
or this to search text: