Table of Contents

Class ObjectSchema.Sequence

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

sys.sequences (Transact-SQL)

Applies to: √ SQL Server (all supported versions) √ Azure SQL Database

Contains a row for each sequence object in a database.


See sys.sequences.

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

Properties

CacheSize

Returns the specified cache size for the sequence object. This column contains NULL if the sequence was created with the NO CACHE option or if CACHE was specified without specifying a cache size. If the value specified by the cache size is larger than the maximum number of values that can be returned by the sequence object, that unobtainable cache size is still displayed.

[Column("cache_size")]
[Nullable]
public object? CacheSize { get; set; }

Property Value

object

CreateDate

Date the object was created.

[Column("create_date")]
[NotNull]
public DateTime CreateDate { get; set; }

Property Value

DateTime

CurrentValue

The last value obligated. That is, the value returned from the most recent execution of the NEXT VALUE FOR function or the last value from executing the sp_sequence_get_range procedure. Returns the START WITH value if the sequence has never been used.

[Column("current_value")]
[NotNull]
public object CurrentValue { get; set; }

Property Value

object

Increment

The value that is used to increment the sequence object after each generated value.

[Column("increment")]
[NotNull]
public object Increment { get; set; }

Property Value

object

IsCached

Returns 0 if NO CACHE has been specified for the sequence object and 1 if CACHE has been specified.

[Column("is_cached")]
[Nullable]
public object? IsCached { get; set; }

Property Value

object

IsCycling

Returns 0 if NO CYCLE has been specified for the sequence object and 1 if CYCLE has been specified.

[Column("is_cycling")]
[Nullable]
public object? IsCycling { get; set; }

Property Value

object

IsExhausted

0 indicates that more values can be generated from the sequence. 1 indicates that the sequence object has reached the MAXVALUE parameter and the sequence is not set to CYCLE. The NEXT VALUE FOR function returns an error until the sequence is restarted by using ALTER SEQUENCE.

[Column("is_exhausted")]
[NotNull]
public object IsExhausted { get; set; }

Property Value

object

IsMSShipped

Object is created by an internal SQL Server component.

[Column("is_ms_shipped")]
[NotNull]
public bool IsMSShipped { get; set; }

Property Value

bool

IsPublished

Object is published.

[Column("is_published")]
[NotNull]
public bool IsPublished { get; set; }

Property Value

bool

IsSchemaPublished

Only the schema of the object is published.

[Column("is_schema_published")]
[NotNull]
public bool IsSchemaPublished { get; set; }

Property Value

bool

LastUsedValue

Returns the last value generated by the Next Value For function. Applies to SQL Server 2017 and later.

[Column("last_used_value")]
[Nullable]
public object? LastUsedValue { get; set; }

Property Value

object

MaximumValue

The maximum value that can be generated by the sequence object. After this value is reached the sequence object will either start returning an error when trying to generate more values or restart if the CYCLE option is specified. If no MAXVALUE has been specified this column returns the maximum value supported by the sequence object's data type.

[Column("maximum_value")]
[NotNull]
public object MaximumValue { get; set; }

Property Value

object

MinimumValue

The minimum value that can be generated by the sequence object. After this value is reached, the sequence object will either return an error when trying to generate more values or restart if the CYCLE option is specified. If no MINVALUE has been specified, this column returns the minimum value supported by the sequence generator's data type.

[Column("minimum_value")]
[NotNull]
public object MinimumValue { get; set; }

Property Value

object

ModifyDate

Date the object was last modified by using an ALTER statement. If the object is a table or a view, modify_date also changes when an index on the table or view is created or altered.

[Column("modify_date")]
[NotNull]
public DateTime ModifyDate { get; set; }

Property Value

DateTime

Name

Object name.

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

Property Value

string

Object

objects (sys.objects)

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

Property Value

ObjectSchema.Object

ObjectID

Object identification number. Is unique within a database.

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

Property Value

int

ParentObjectID

ID of the object to which this object belongs.

0 = Not a child object.

[Column("parent_object_id")]
[NotNull]
public int ParentObjectID { get; set; }

Property Value

int

Precision

Max precision of the data type.

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

Property Value

object

PrincipalID

ID of the individual owner, if different from the schema owner. By default, schema-contained objects are owned by the schema owner. However, an alternate owner can be specified by using the ALTER AUTHORIZATION statement to change ownership.

Is NULL if there is no alternate individual owner.

Is NULL if the object type is one of the following:

C = CHECK constraint

D = DEFAULT (constraint or stand-alone)

F = FOREIGN KEY constraint

PK = PRIMARY KEY constraint

R = Rule (old-style, stand-alone)

TA = Assembly (CLR-integration) trigger

TR = SQL trigger

UQ = UNIQUE constraint

EC = Edge constraint

[Column("principal_id")]
[Nullable]
public int? PrincipalID { get; set; }

Property Value

int?

Scale

Max scale of the type. Scale is returned together with precision to give users complete metadata. Scale is always 0 for sequence objects because only integer types are allowed.

[Column("scale")]
[Nullable]
public object? Scale { get; set; }

Property Value

object

SchemaID

ID of the schema that the object is contained in.

Schema-scoped system objects are always contained in the sys or INFORMATION_SCHEMA schemas.

[Column("schema_id")]
[NotNull]
public int SchemaID { get; set; }

Property Value

int

StartValue

The starting value for the sequence object. If the sequence object is restarted by using ALTER SEQUENCE it will restart at this value. When the sequence object cycles it proceeds to the minimum_value or maximum_value, not the start_value.

[Column("start_value")]
[NotNull]
public object StartValue { get; set; }

Property Value

object

SystemTypeID

ID of the system type for sequence object's data type.

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

Property Value

object

TypeColumn

Object type:

AF = Aggregate function (CLR)

C = CHECK constraint

D = DEFAULT (constraint or stand-alone)

F = FOREIGN KEY constraint

FN = SQL scalar function

FS = Assembly (CLR) scalar-function

FT = Assembly (CLR) table-valued function

IF = SQL inline table-valued function

IT = Internal table

P = SQL Stored Procedure

PC = Assembly (CLR) stored-procedure

PG = Plan guide

PK = PRIMARY KEY constraint

R = Rule (old-style, stand-alone)

RF = Replication-filter-procedure

S = System base table

SN = Synonym

SO = Sequence object

U = Table (user-defined)

V = View

EC = Edge constraint



Applies to: SQL Server 2012 (11.x) and later.

SQ = Service queue

TA = Assembly (CLR) DML trigger

TF = SQL table-valued-function

TR = SQL DML trigger

TT = Table type

UQ = UNIQUE constraint

X = Extended stored procedure



Applies to: SQL Server 2014 (12.x) and later, Azure SQL Database, Azure Synapse Analytics, Analytics Platform System (PDW).

ST = STATS_TREE



Applies to: SQL Server 2016 (13.x) and later, Azure SQL Database, Azure Synapse Analytics, Analytics Platform System (PDW).

ET = External Table

[Column("type")]
[Nullable]
public string? TypeColumn { get; set; }

Property Value

string

TypeDesc

Description of the object type:

AGGREGATE_FUNCTION

CHECK_CONSTRAINT

CLR_SCALAR_FUNCTION

CLR_STORED_PROCEDURE

CLR_TABLE_VALUED_FUNCTION

CLR_TRIGGER

DEFAULT_CONSTRAINT

EXTENDED_STORED_PROCEDURE

FOREIGN_KEY_CONSTRAINT

INTERNAL_TABLE

PLAN_GUIDE

PRIMARY_KEY_CONSTRAINT

REPLICATION_FILTER_PROCEDURE

RULE

SEQUENCE_OBJECT



Applies to: SQL Server 2012 (11.x) and later.

SERVICE_QUEUE

SQL_INLINE_TABLE_VALUED_FUNCTION

SQL_SCALAR_FUNCTION

SQL_STORED_PROCEDURE

SQL_TABLE_VALUED_FUNCTION

SQL_TRIGGER

SYNONYM

SYSTEM_TABLE

TABLE_TYPE

UNIQUE_CONSTRAINT

USER_TABLE

VIEW

[Column("type_desc")]
[Nullable]
public string? TypeDesc { get; set; }

Property Value

string

UserTypeID

ID of the data type for the sequence object as defined by the user.

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

Property Value

object