Skip to content

Instantly share code, notes, and snippets.

@jrichardsz
Created September 17, 2024 17:27
Show Gist options
  • Save jrichardsz/c2e8b45189c1165c9217d02817fbb23f to your computer and use it in GitHub Desktop.
Save jrichardsz/c2e8b45189c1165c9217d02817fbb23f to your computer and use it in GitHub Desktop.
sql dependencies - snippets
SELECT OBJECT_NAME(referencing_id) AS referencing_entity_name,   
    o.type_desc AS referencing_desciption,   
    COALESCE(COL_NAME(referencing_id, referencing_minor_id), '(n/a)') AS referencing_minor_id,   
    referencing_class_desc,  
    referenced_server_name, referenced_database_name, referenced_schema_name,  
    referenced_entity_name,   
    COALESCE(COL_NAME(referenced_id, referenced_minor_id), '(n/a)') AS referenced_column_name,  
    is_caller_dependent, is_ambiguous  
FROM sys.sql_expression_dependencies AS sed  
INNER JOIN sys.objects AS o ON sed.referencing_id = o.object_id  
WHERE referencing_id = OBJECT_ID(N'SchemaName.StoredProcedureName');  
GO

Source

https://stackoverflow.com/a/63573451/3957754

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment