question

tiwaryrohit143 avatar image
tiwaryrohit143 asked

Script to find table dependencies of all stored procedure in a database

Can anypne help me and give me a script.

Script to find table dependencies of all stored procedure in a database.

Thanks in advance.

Rohit

t-sqlsql-server-2012dependency-check
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
WRBI avatar image
WRBI answered

I don't have a script but you could start with these two DMVs, they may provide you what you need:

https://docs.microsoft.com/en-us/sql/relational-databases/system-dynamic-management-views/sys-dm-sql-referencing-entities-transact-sql

https://docs.microsoft.com/en-us/sql/relational-databases/system-dynamic-management-views/sys-dm-sql-referenced-entities-transact-sql

Alternatively, try the trial of Redgate's SQL Dependency Tracker, then if you like it, buy it :D Its saved us tonnes of time in the past and the export options are brilliant.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.