Table of Contents

Class ObjectSchema.SystemColumn

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

sys.system_columns (Transact-SQL)

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

Contains a row for each column of system objects that have columns.


See sys.system_columns.

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

Properties

CollationName

Name of the collation of the column if character-based; otherwise, NULL.

[Column("collation_name")]
[Nullable]
public string? CollationName { get; set; }

Property Value

string

ColumnID

ID of the column. Is unique within the object.

Column IDs might not be sequential.

[Column("column_id")]
[NotNull]
public int ColumnID { get; set; }

Property Value

int

DefaultObjectID

ID of the default object, regardless of whether it is a stand-alone sys.sp_bindefault, or an inline, column-level DEFAULT constraint. The parent_object_id column of an inline column-level default object is a reference back to the table itself. Or, 0 if there is no default.

[Column("default_object_id")]
[NotNull]
public int DefaultObjectID { get; set; }

Property Value

int

GeneratedAlwaysType

Applies to: SQL Server 2016 (13.x) and later, SQL Database. 7, 8, 9, 10 only applies to SQL Database.

Identifies when the column value is generated (will always be 0 for columns in system tables):

0 = NOT_APPLICABLE
1 = AS_ROW_START
2 = AS_ROW_END
7 = AS_TRANSACTION_ID_START
8 = AS_TRANSACTION_ID_END
9 = AS_SEQUENCE_NUMBER_START
10 = AS_SEQUENCE_NUMBER_END

For more information, see Temporal Tables (Relational databases).

[Column("generated_always_type")]
[Nullable]
public byte? GeneratedAlwaysType { get; set; }

Property Value

byte?

GeneratedAlwaysTypeDesc

Applies to: SQL Server 2016 (13.x) and later, SQL Database.

Textual description of generated_always_type's value (always NOT_APPLICABLE for columns in system tables)

NOT_APPLICABLE
AS_ROW_START
AS_ROW_END

Applies to: SQL Database

AS_TRANSACTION_ID_START
AS_TRANSACTION_ID_END
AS_SEQUENCE_NUMBER_START
AS_SEQUENCE_NUMBER_END

[Column("generated_always_type_desc")]
[Nullable]
public string? GeneratedAlwaysTypeDesc { get; set; }

Property Value

string

IsAnsiPadded

1 = Column uses ANSI_PADDING ON behavior if character, binary, or variant.

0 = Column is not character, binary, or variant.

[Column("is_ansi_padded")]
[NotNull]
public bool IsAnsiPadded { get; set; }

Property Value

bool

IsColumnSet

1 = Column is a column set. For more information, see Use Column Sets.

[Column("is_column_set")]
[NotNull]
public bool IsColumnSet { get; set; }

Property Value

bool

IsComputed

1 = Column is a computed column.

[Column("is_computed")]
[NotNull]
public bool IsComputed { get; set; }

Property Value

bool

IsDtsReplicated

1 = Column is replicated by using SSIS.

[Column("is_dts_replicated")]
[NotNull]
public bool IsDtsReplicated { get; set; }

Property Value

bool

IsFilestream

1 = Column is declared to use filestream storage.

[Column("is_filestream")]
[NotNull]
public bool IsFilestream { get; set; }

Property Value

bool

IsIdentity

1 = Column has identity values.

[Column("is_identity")]
[NotNull]
public bool IsIdentity { get; set; }

Property Value

bool

IsMergePublished

1 = Column is merge-published.

[Column("is_merge_published")]
[NotNull]
public bool IsMergePublished { get; set; }

Property Value

bool

IsNonSqlSubscribed

1 = Column has a non-SQL Server subscriber.

[Column("is_non_sql_subscribed")]
[NotNull]
public bool IsNonSqlSubscribed { get; set; }

Property Value

bool

IsNullable

1 = Column is nullable.

[Column("is_nullable")]
[Nullable]
public bool? IsNullable { get; set; }

Property Value

bool?

IsReplicated

1 = Column is replicated.

[Column("is_replicated")]
[NotNull]
public bool IsReplicated { get; set; }

Property Value

bool

IsRowGuidCol

1 = Column is a declared ROWGUIDCOL.

[Column("is_rowguidcol")]
[NotNull]
public bool IsRowGuidCol { get; set; }

Property Value

bool

IsSparse

1 = Column is a sparse column. For more information, see Use Sparse Columns.

[Column("is_sparse")]
[NotNull]
public bool IsSparse { get; set; }

Property Value

bool

IsXmlDocument

1 = Content is a complete XML document.

0 = Content is a document fragment, or the column data type is not xml.

[Column("is_xml_document")]
[NotNull]
public bool IsXmlDocument { get; set; }

Property Value

bool

LedgerViewColumnType

Applies to: SQL Database.

If not NULL, indicates the type of a column in a ledger view:

1 = TRANSACTION_ID
2 = SEQUENCE_NUMBER
3 = OPERATION_TYPE
4 = OPERATION_TYPE_DESC

For more information on database ledger, see Azure SQL Database ledger.

[Column("ledger_view_column_type")]
[NotNull]
public byte LedgerViewColumnType { get; set; }

Property Value

byte

LedgerViewColumnTypeDesc

Applies to: SQL Database.

If not NULL, contains a textual description of the the type of a column in a ledger view:

TRANSACTION_ID
SEQUENCE_NUMBER
OPERATION_TYPE
OPERATION_TYPE_DESC

[Column("ledger_view_column_type_desc")]
[NotNull]
public string LedgerViewColumnTypeDesc { get; set; }

Property Value

string

MaxLength

Maximum length (in bytes) of column.

-1 = Column data type is varchar(max), nvarchar(max), varbinary(max), or xml.

For text columns, the max_length value will be 16 or the value set by sp_tableoption 'text in row'.

[Column("max_length")]
[NotNull]
public short MaxLength { get; set; }

Property Value

short

Name

Name of the column. Is unique within the object.

[Column("name")]
[Nullable]
public string? Name { get; set; }

Property Value

string

ObjectID

ID of the object to which this column belongs.

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

Property Value

int

Precision

Precision of the column if numeric-based; otherwise, 0.

[Column("precision")]
[NotNull]
public byte Precision { get; set; }

Property Value

byte

RuleObjectID

ID of the stand-alone rule bound to the column by using sys.sp_bindrule.

0 = No stand-alone rule.

For column-level CHECK constraints, see sys.check_constraints (Transact-SQL).

[Column("rule_object_id")]
[NotNull]
public int RuleObjectID { get; set; }

Property Value

int

Scale

Scale of the column if numeric-based; otherwise, 0.

[Column("scale")]
[NotNull]
public byte Scale { get; set; }

Property Value

byte

SystemObject

system_objects (sys.system_objects)

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

Property Value

ObjectSchema.SystemObject

SystemTypeID

ID of the system-type of the column

[Column("system_type_id")]
[NotNull]
public byte SystemTypeID { get; set; }

Property Value

byte

UserTypeID

ID of the type of the column as defined by the user.

To return the name of the type, join to the sys.types catalog view on this column.

[Column("user_type_id")]
[NotNull]
public int UserTypeID { get; set; }

Property Value

int

XmlCollectionID

Non-zero if the column data type is xml and the XML is typed. The value will be the ID of the collection containing the validating XML schema namespace of the column.

0 = No XML schema collection.

[Column("xml_collection_id")]
[NotNull]
public int XmlCollectionID { get; set; }

Property Value

int