Is it possible to insert 0 in the primary key field of a table in SQL server 2008?
Is it possible to insert 0 in the primary key field of a table
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As long it’s a numeric field, yes… follow along at home!
The
primary keyrestriction only requires that the value be unique and the column not be nullable.For an
identityfield:The
identity(1, 1)means “start at one and increment by one each time something is inserted”. You could haveidentity(-100, 10)to start at-100and increment by10each time. Or you could start at0. There’s no restriction.You can generally answer questions like these for yourself by just trying them and seeing if they work. This is faster and usually more beneficial than asking on StackOverflow.