kelli smitt
kelli smitt

Reputation: 137

CREATE SEQUENCE Error : invalid value for 'INCREMENT BY'

CREATE SEQUENCE dbo.Sequence1
AS decimal
START WITH 1 INCREMENT BY 0.3
MINVALUE 2 MAXVALUE 4
CYCLE;

Error :

An invalid value was specified for argument 'INCREMENT BY' for the given data type.

I want to create a fractional counter. What's wrong? Nope support decimal?

UPD:

When I create

CREATE SEQUENCE dbo.Sequence1
AS float
....

SQL Server Management Studio returns error :

The sequence object 'dbo.Sequence1' must be of data type int, bigint, smallint, tinyint, or decimal or numeric with a scale of 0, or any user-defined data type that is based on one of the above integer data types.

That's why I'm trying to create a sequence with the decimal type.

Upvotes: 0

Views: 1023

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1270191

This is a bit long for a comment. The documentation is quite specific that create sequence is for integers:

[built_in_integer_type | user-defined_integer_type]

A sequence can be defined as any integer type. The following types are allowed.

(Emphasis is mine.)

Hence, values with decimal points are not allowed.

decimal is only allowed with a scale of 0 (meaning that there are no decimal points).

Upvotes: 3

Related Questions