question

Naina_S avatar image
Naina_S asked

find out the dependencies of all Table and Procedure with single query

Hello All, Please let me know how to find out the dependencies of all Table and Procedure with single query in sql server 2008/ complete database dependencies with single query. Thanks Naina
sql-server-2008sql
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

·
Matt Whitfield avatar image
Matt Whitfield answered
For finding out about all the things that tables and procedures are referenced by (not what you asked, but seems to be a sensible interpretation). Note that this query will not produce results for non-schema-bound references... SELECT * FROM [sys].[sql_expression_dependencies] WHERE [referenced_class] = 1 AND [referenced_id] IN (SELECT [object_id] FROM [sys].[objects] WHERE [type] IN ('U', 'P')); For finding out about all the things that tables and procedures reference (which seems to be what you ask, but doesn't make as much sense) SELECT * FROM [sys].[sql_expression_dependencies] WHERE [referencing_class] = 1 AND [referencing_id] IN (SELECT [object_id] FROM [sys].[objects] WHERE [type] IN ('U', 'P'));
1 comment
10 |1200

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

Naina_S avatar image Naina_S commented ·
Thanks a lot Matt
0 Likes 0 ·

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.