Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can an identity column be zero?
Message
From
27/11/2010 22:53:30
 
 
To
27/11/2010 18:07:10
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2008
Miscellaneous
Thread ID:
01490715
Message ID:
01490728
Views:
61
Bill in addition to the replies you received, one other thing...

In unusual situations where someone might want to manually insert an identity value, you can toggle the identity_insert setting, and you can insert any value (even a zero).

For example (again, not a common situation):
CREATE TABLE Test  (MyIdentity int identity primary key clustered,  Name varchar(100))
GO

insert into Test (Name) values ('Kevin')

set identity_insert Test on
insert into Test (MyIdentity, Name) values (0, 'Row for zero')
set identity_insert Test off

select * from Test

MyIdentity                           Name
0                                   Row for zero
1                                   Kevin
Previous
Reply
Map
View

Click here to load this message in the networking platform