Table of Contents

Class ObjectSchema.SqlModule

Namespace
LinqToDB.Tools.DataProvider.SqlServer.Schemas
Assembly
linq2db.Tools.dll

sys.sql_modules (Transact-SQL)

Applies to: √ SQL Server (all supported versions) √ Azure SQL Database √ Azure SQL Managed Instance √ Azure Synapse Analytics √ Analytics Platform System (PDW)

Returns a row for each object that is an SQL language-defined module in SQL Server, including natively compiled scalar user-defined function. Objects of type P, RF, V, TR, FN, IF, TF, and R have an associated SQL module. Stand-alone defaults, objects of type D, also have an SQL module definition in this view. For a description of these types, see the type column in the sys.objects catalog view.
For more information, see Scalar User-Defined Functions for In-Memory OLTP.


See sys.sql_modules.

[Table(Schema = "sys", Name = "sql_modules", IsView = true)]
public class ObjectSchema.SqlModule
Inheritance
ObjectSchema.SqlModule
Extension Methods

Properties

Definition

SQL text that defines this module. This value can also be obtained using the OBJECT_DEFINITION built-in function.

NULL = Encrypted.

[Column("definition")]
[Nullable]
public string? Definition { get; set; }

Property Value

string

ExecuteAsPrincipalID

ID of the EXECUTE AS database principal.

NULL by default or if EXECUTE AS CALLER.

ID of the specified principal if EXECUTE AS SELF or EXECUTE AS <principal>.

-2 = EXECUTE AS OWNER.

[Column("execute_as_principal_id")]
[Nullable]
public object? ExecuteAsPrincipalID { get; set; }

Property Value

object

InlineType

Applies to: SQL Server 2019 (15.x) and later.

Indicates whether inlining is turned on for the module currently.

0 = inlining is turned off

1 = inlining is turned on.

For scalar user-defined functions (UDFs), the value will be 1 if inlining is turned on (explicitly or implicitly). The value will always be 1 for inline table-valued functions (TVFs), and 0 for other module types.

[Column("inline_type")]
[Nullable]
public bool? InlineType { get; set; }

Property Value

bool?

IsInlineable

Applies to: SQL Server 2019 (15.x) and later.

Indicates whether the module is inlineable or not. Inlineability is based on the conditions specified here.

0 = not inlineable

1 = is inlineable.

For scalar user-defined functions (UDFs), the value will be 1 if the UDF is inlineable, and 0 otherwise. It always contains a value of 1 for inline table-valued functions (TVFs), and 0 for all other module types.

[Column("is_inlineable")]
[Nullable]
public bool? IsInlineable { get; set; }

Property Value

bool?

IsRecompiled

Procedure was created WITH RECOMPILE option.

[Column("is_recompiled")]
[Nullable]
public bool? IsRecompiled { get; set; }

Property Value

bool?

IsSchemaBound

Module was created with SCHEMABINDING option.

Always contains a value of 1 for natively compiled stored procedures.

[Column("is_schema_bound")]
[Nullable]
public bool? IsSchemaBound { get; set; }

Property Value

bool?

NullOnNullInput

Module was declared to produce a NULL output on any NULL input.

[Column("null_on_null_input")]
[Nullable]
public bool? NullOnNullInput { get; set; }

Property Value

bool?

Object

objects (sys.objects)

[Association(ThisKey = "ObjectID", OtherKey = "ObjectID", CanBeNull = false)]
public ObjectSchema.Object Object { get; set; }

Property Value

ObjectSchema.Object

ObjectID

ID of the object of the containing object. Is unique within a database.

[Column("object_id")]
[NotNull]
public int ObjectID { get; set; }

Property Value

int

UsesAnsiNulls

Module was created with SET ANSI_NULLS ON.

Will always be = 0 for rules and defaults.

[Column("uses_ansi_nulls")]
[Nullable]
public bool? UsesAnsiNulls { get; set; }

Property Value

bool?

UsesDatabaseCollation

1 = Schema-bound module definition depends on the default-collation of the database for correct evaluation; otherwise, 0. Such a dependency prevents changing the database's default collation.

[Column("uses_database_collation")]
[Nullable]
public bool? UsesDatabaseCollation { get; set; }

Property Value

bool?

UsesNativeCompilation

Applies to: SQL Server 2014 (12.x) through SQL Server 2014 (12.x).

0 = not natively compiled

1 = is natively compiled

The default value is 0.

[Column("uses_native_compilation")]
[Nullable]
public bool? UsesNativeCompilation { get; set; }

Property Value

bool?

UsesQuotedIdentifier

Module was created with SET QUOTED_IDENTIFIER ON.

[Column("uses_quoted_identifier")]
[Nullable]
public bool? UsesQuotedIdentifier { get; set; }

Property Value

bool?