Identity Column with int, bigint, and decimal(38,0)


 create table test (tid decimal(38,0) identity(9223372036854775805,1),col1 varchar(10))
insert into test values('a1'),('a2'),('a3'),('a4'),('a5'),('a6')


select tid, col1 from test
 

select cast(9223372036854775807 as bigint) --works
--select cast(9223372036854775808 as bigint) -- error 

select cast(replicate('9',38) as decimal(38,0)) [the largest number in SQL Server] 


drop table test
 

 bigint
-2^63 (-9,223,372,036,854,775,808) to 2^63-1 (9,223,372,036,854,775,807)
int
-2^31 (-2,147,483,648) to 2^31-1 (2,147,483,647)

smallint
-2^15 (-32,768) to 2^15-1 (32,767)

tinyint
0 to 255


The decimal can go up to 10^38 - 1 with decimal (38,0)