Class ObjectSchema.SqlExpressionDependency
- Namespace
- LinqToDB.Tools.DataProvider.SqlServer.Schemas
- Assembly
- linq2db.Tools.dll
sys.sql_expression_dependencies (Transact-SQL)
Applies to: √ SQL Server (all supported versions) √ Azure SQL Managed Instance √ Azure Synapse Analytics √ Analytics Platform System (PDW)
Contains one row for each by-name dependency on a user-defined entity in the current database. This includes dependences between natively compiled, scalar user-defined functions and other SQL Server modules. A dependency between two entities is created when one entity, called the *referenced entity*, appears by name in a persisted SQL expression of another entity, called the *referencing entity*. For example, when a table is referenced in the definition of a view, the view, as the referencing entity, depends on the table, the referenced entity. If the table is dropped, the view is unusable.
For more information, see Scalar User-Defined Functions for In-Memory OLTP.
You can use this catalog view to report dependency information for the following entities:
- Schema-bound entities.
- Non-schema-bound entities.
- Cross-database and cross-server entities. Entity names are reported; however, entity IDs are not resolved.
- Column-level dependencies on schema-bound entities. Column-level dependencies for non-schema-bound objects can be returned by using sys.dm_sql_referenced_entities.
- Server-level DDL triggers when in the context of the master database.
[Table(Schema = "sys", Name = "sql_expression_dependencies", IsView = true)]
public class ObjectSchema.SqlExpressionDependency
- Inheritance
-
ObjectSchema.SqlExpressionDependency
- Extension Methods
Properties
IsAmbiguous
Indicates the reference is ambiguous and can resolve at run time to a user-defined function, a user-defined type (UDT), or an xquery reference to a column of type xml.
For example, assume that the statement SELECT Sales.GetOrder() FROM Sales.MySales
is defined in a stored procedure. Until the stored procedure is executed, it is not known whether Sales.GetOrder()
is a user-defined function in the Sales
schema or column named Sales
of type UDT with a method named GetOrder()
.
1 = Reference is ambiguous.
0 = Reference is unambiguous or the entity can be successfully bound when the view is called.
Always 0 for schema bound references.
[Column("is_ambiguous")]
[NotNull]
public bool IsAmbiguous { get; set; }
Property Value
IsCallerDependent
Indicates that schema binding for the referenced entity occurs at runtime; therefore, resolution of the entity ID depends on the schema of the caller. This occurs when the referenced entity is a stored procedure, extended stored procedure, or a non-schema-bound user-defined function called in an EXECUTE statement.
1 = The referenced entity is caller dependent and is resolved at runtime. In this case, referenced_id is NULL.
0 = The referenced entity ID is not caller dependent.
Always 0 for schema-bound references and for cross-database and cross-server references that explicitly specify a schema name. For example, a reference to an entity in the format EXEC MyDatabase.MySchema.MyProc
is not caller dependent. However, a reference in the format EXEC MyDatabase..MyProc
is caller dependent.
[Column("is_caller_dependent")]
[NotNull]
public bool IsCallerDependent { get; set; }
Property Value
IsSchemaBoundReference
1 = Referenced entity is schema-bound.
0 = Referenced entity is non-schema-bound.
Is not nullable.
[Column("is_schema_bound_reference")]
[NotNull]
public bool IsSchemaBoundReference { get; set; }
Property Value
ReferencedClass
Class of the referenced entity.
1 = Object or column
6 = Type
10 = XML schema collection
21 = Partition function
Is not nullable.
[Column("referenced_class")]
[Nullable]
public byte? ReferencedClass { get; set; }
Property Value
- byte?
ReferencedClassDesc
Description of class of referenced entity.
OBJECT_OR_COLUMN
TYPE
XML_SCHEMA_COLLECTION
PARTITION_FUNCTION
Is not nullable.
[Column("referenced_class_desc")]
[Nullable]
public string? ReferencedClassDesc { get; set; }
Property Value
ReferencedDatabaseName
Name of the database of the referenced entity.
This column is populated for cross-database or cross-server references that are made by specifying a valid three-part or four-part name.
NULL for non-schema-bound references when specified using a one-part or two-part name.
NULL for schema-bound entities because they must be in the same database and therefore can only be defined using a two-part (schema.object) name.
[Column("referenced_database_name")]
[Nullable]
public string? ReferencedDatabaseName { get; set; }
Property Value
ReferencedEntityName
Name of the referenced entity. Is not nullable.
[Column("referenced_entity_name")]
[Nullable]
public string? ReferencedEntityName { get; set; }
Property Value
ReferencedID
ID of the referenced entity. The value of this column is never NULL for schema-bound references. The value of this column is always NULL for cross-server and cross-database references.
NULL for references within the database if the ID cannot be determined. For non-schema-bound references, the ID cannot be resolved in the following cases:
The referenced entity does not exist in the database.
The schema of the referenced entity depends on the schema of the caller and is resolved at run time. In this case, is_caller_dependent is set to 1.
[Column("referenced_id")]
[Nullable]
public int? ReferencedID { get; set; }
Property Value
- int?
ReferencedMinorID
ID of the referenced column when the referencing entity is a column; otherwise 0. Is not nullable.
A referenced entity is a column when a column is identified by name in the referencing entity, or when the parent entity is used in a SELECT * statement.
[Column("referenced_minor_id")]
[NotNull]
public int ReferencedMinorID { get; set; }
Property Value
ReferencedSchemaName
Schema in which the referenced entity belongs.
NULL for non-schema-bound references in which the entity was referenced without specifying the schema name.
Never NULL for schema-bound references because schema-bound entities must be defined and referenced by using a two-part name.
[Column("referenced_schema_name")]
[Nullable]
public string? ReferencedSchemaName { get; set; }
Property Value
ReferencedServerName
Name of the server of the referenced entity.
This column is populated for cross-server dependencies that are made by specifying a valid four-part name. For information about multipart names, see Transact-SQL Syntax Conventions (Transact-SQL).
NULL for non-schema-bound entities for which the entity was referenced without specifying a four-part name.
NULL for schema-bound entities because they must be in the same database and therefore can only be defined using a two-part (schema.object) name.
[Column("referenced_server_name")]
[Nullable]
public string? ReferencedServerName { get; set; }
Property Value
ReferencingClass
Class of the referencing entity.
1 = Object or column
12 = Database DDL trigger
13 = Server DDL trigger
Is not nullable.
[Column("referencing_class")]
[Nullable]
public byte? ReferencingClass { get; set; }
Property Value
- byte?
ReferencingClassDesc
Description of the class of referencing entity.
OBJECT_OR_COLUMN
DATABASE_DDL_TRIGGER
SERVER_DDL_TRIGGER
Is not nullable.
[Column("referencing_class_desc")]
[Nullable]
public string? ReferencingClassDesc { get; set; }
Property Value
ReferencingID
ID of the referencing entity. Is not nullable.
[Column("referencing_id")]
[NotNull]
public int ReferencingID { get; set; }
Property Value
ReferencingMinorID
Column ID when the referencing entity is a column; otherwise 0. Is not nullable.
[Column("referencing_minor_id")]
[NotNull]
public int ReferencingMinorID { get; set; }