Pages

Monday, August 1, 2011

SQL Server - An identity feild can have negative seed value and negative increments also

Always everyone will start identity value from 1 and increment by 1. However, an identity column can have negative seed value and can be negatively also incremented. Suppose below table will have 4 rows with id values -100,-101,-102,-103

declare @t table
(
Id int identity(-100,-1),
Col1 int
)
insert into @t values (1),(2),(3),(4)
select * from @t

No comments:

Post a Comment