Check if SQL object is referenced by any other SQL objects

VixterJ

I was just reading this SO thread and had a question for @Mack regarding whether there is a way to check if a SQL object is referenced by any other SQL objects.

He (@Mack) used T-SQL and DMVs to accomplish something similar in his answer.

Is this possible, if so how?

I would have posted this as a comment, but I don't have sufficient reputation yet...

Mack

You can, but not with a DMV instead you'll need a related dynamic management function(DMF) dm_sql_referencing_entities (more info here).

Here is the code:

SELECT referencing_schema_name
     , referencing_entity_name
FROM sys.dm_sql_referencing_entities ('*schemaname.objectname*', 'OBJECT');

Here's a link to the MSDN page on DMVs and DMFs.

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

SQL Server check if where clause is true for any row

분류에서Dev

SQL Query to check Range

분류에서Dev

NSPredicate SUBQUERY for object composed of arrays of other objects

분류에서Dev

how is Array object different from other objects

분류에서Dev

check if any other copy is in process before my xcopy command

분류에서Dev

Join 2 other tables with SQL?

분류에서Dev

SQL Union "All Other" Row

분류에서Dev

Regex in SQL Server to check whitespaces

분류에서Dev

C# SQL database check

분류에서Dev

Creating a composite object from two other core data objects

분류에서Dev

sys.sql_modules 및 sys.objects의 잘못된 object_name 및 정의 관계

분류에서Dev

Way to do "Any" on an aggregation in SQL Server

분류에서Dev

IN query not returning any result, worklight SQL Adapter

분류에서Dev

Saving model object into SQL DB

분류에서Dev

sql dependency Invalid object name '

분류에서Dev

SQL: group by from other table and invert result

분류에서Dev

SQL Update a column dependent on other two columns

분류에서Dev

SQL Database vs Java Serialized Objects To File?

분류에서Dev

MS SQL coonditional check null 값

분류에서Dev

SQL select where but only check if parameter is true

분류에서Dev

sql: How to check a zipcode is exist in zipcode range

분류에서Dev

SQL unique : manual check vs catch exception

분류에서Dev

how to check for a null value in t-sql

분류에서Dev

Check row existence in SQL Server with PowerShell

분류에서Dev

Мой SQL вернул пустой набор результатов, какое решение?

분류에서Dev

Процедура SQL выполняет первую строку, а затем останавливается

분류에서Dev

SQL Query- Table as invalid object

분류에서Dev

Using AutoMapper to create an object, which represents a result of comparing two other objects

분류에서Dev

Loop over a reference object multiple times to copy its properties to other objects in Javascript/Angularjs

Related 관련 기사

  1. 1

    SQL Server check if where clause is true for any row

  2. 2

    SQL Query to check Range

  3. 3

    NSPredicate SUBQUERY for object composed of arrays of other objects

  4. 4

    how is Array object different from other objects

  5. 5

    check if any other copy is in process before my xcopy command

  6. 6

    Join 2 other tables with SQL?

  7. 7

    SQL Union "All Other" Row

  8. 8

    Regex in SQL Server to check whitespaces

  9. 9

    C# SQL database check

  10. 10

    Creating a composite object from two other core data objects

  11. 11

    sys.sql_modules 및 sys.objects의 잘못된 object_name 및 정의 관계

  12. 12

    Way to do "Any" on an aggregation in SQL Server

  13. 13

    IN query not returning any result, worklight SQL Adapter

  14. 14

    Saving model object into SQL DB

  15. 15

    sql dependency Invalid object name '

  16. 16

    SQL: group by from other table and invert result

  17. 17

    SQL Update a column dependent on other two columns

  18. 18

    SQL Database vs Java Serialized Objects To File?

  19. 19

    MS SQL coonditional check null 값

  20. 20

    SQL select where but only check if parameter is true

  21. 21

    sql: How to check a zipcode is exist in zipcode range

  22. 22

    SQL unique : manual check vs catch exception

  23. 23

    how to check for a null value in t-sql

  24. 24

    Check row existence in SQL Server with PowerShell

  25. 25

    Мой SQL вернул пустой набор результатов, какое решение?

  26. 26

    Процедура SQL выполняет первую строку, а затем останавливается

  27. 27

    SQL Query- Table as invalid object

  28. 28

    Using AutoMapper to create an object, which represents a result of comparing two other objects

  29. 29

    Loop over a reference object multiple times to copy its properties to other objects in Javascript/Angularjs

뜨겁다태그

보관