One of the members in the forum asked about using decimal datatype in identity column. The question was "Is decimal point allowed in the identity column?" Ok. The identity column can never have any decimal points. It is a whole number. The decimal datatype can be used to have a bigger number in the identity column as decimal can have maximum of 38 digits.
The following are the code to create an identity column with decimal datatype
1 Specify scale as 0
declare @t table(i decimal(38,0) identity(1,1)) insert into @t default values select * from @t
2 Omit scale part
declare @t table(i decimal(38) identity(1,1)) insert into @t default values select * from @t
Tags: t-sql, sql_server, decimal, sqlserver, tsql, identity,
It's interesting to use the decimal data-type as an identity column.
by using decimal type, the range values may be increased with respect to bigint type