Finding Object Reference - SQL Server

Posted by: bart30508 | in SQL Server | 2 months ago |

Script like below :

SELECT
    OBJECT_NAME(referencing_id) AS [Referencing Entity],
    OBJECT_NAME(referencing_minor_id) AS [Referencing Minor Entity],
    referencing_class_desc AS [Referencing Entity Class],
    COL_NAME(referenced_id, referenced_minor_id) AS [Column],
    o.type_desc AS [Type],   
    COALESCE(COL_NAME(referencing_id, referencing_minor_id), '(n/a)') AS [Column],

    referenced_server_name AS [Referenced Server],
    referenced_database_name AS [Referenced DB],
    referenced_schema_name AS [Referenced Schema],
    referenced_entity_name AS [Referenced Entity],
    referenced_class_desc AS [Referenced Entity Class] ,
    (select type from sys.objects where  object_id = referenced_id ) AS [Type],   
    COALESCE(COL_NAME(referenced_id, referenced_minor_id), '(n/a)') AS [Column]
FROM 
    sys.sql_expression_dependencies sed
INNER JOIN 
    sys.objects AS o 
ON 
    sed.referencing_id = o.object_id 
WHERE 
    referenced_id = OBJECT_ID('')
    or referencing_id = OBJECT_ID('')
/*  
SELECT
    referenced_server_name
    referenced_database_name ,
    referenced_schema_name ,
    referenced_entity_name ,
    referenced_class_desc,
FROM sys.sql_expression_dependencies
WHERE 
    referenced_id = OBJECT_ID('')
    or referencing_id = OBJECT_ID('')
 */
Currently unrated
 or 

Subscribe

* indicates required

Recent Posts

Archive

2022
2021

Categories

Apache 1

Data Science 2

Dbfit 1

Design Pattern 1

Devops 3

DigitalOcean 1

Django 1

English 3

Excel 5

Flask 3

Git 1

HackMD 1

Heroku 1

Html/Css 1

Linux 4

Machine Learning 2

Manufacture 1

Mezzanine 18

Oracle 1

Postgresql 7

PowerBI 4

Powershell 4

Python 21

SEO 2

SQL Server 51

SQLite 1

Windows 1

database 8

work-experience 1

其他 1

自我成長 1

資料工程 1

Tags

SEO(1) Github(2) Title Tag(2) ML(1) 李宏毅(1) SQL Server(18) Tempdb(1) SSMS(1) Windows(1) 自我成長(2) Excel(1) python Flask(1) python(5) Flask(2)

Authors

bart30508 (146)

Feeds

RSS / Atom

Finding Object Reference - SQL Server

© COPYRIGHT 2011-2022. Max的文藝復興. ALL RIGHT RESERVED.