Member of the LearnItFirst.com Video Training Network | LearnSqlServer.com | SQL SSIS Training | SQL Programming Tutorials |
LearnSqlServer.com Forums LearnSqlServer.com
Welcome Guest Search | New Posts | Members | Log In | Register

The mistake of making a field empty not null provokes that an autonumerical field is increased Options
jpiaya
Posted: Thursday, July 10, 2008 2:12:21 AM
Rank: Newbie

Joined: 7/10/2008
Posts: 3
Points: 9
Hello,

I have a table with a field that is primary key and identity autoincrementable and has also another field that cannot be void,
On having inserted a new record (from the own(proper) Sql Server) and to make empty the field that cannot be void shows me a mistake, then I introduce the value in the above mentioned field and it turns out that the number of the field identity has increased one more number, therefore, a number has skipped.

How can I solve this problem?

It can only very badly that the client who uses the computer application sees hollows between the numbers.

Thank you in advance.
jpiaya
Posted: Thursday, July 10, 2008 10:05:49 AM
Rank: Newbie

Joined: 7/10/2008
Posts: 3
Points: 9
My problem is that if I insert a record of a table that contains a field that cannot be void and for mistake I go on to the following record gives me a mistake that warns me that such a field cannot be void, but later on having inserted the value to the above mentioned field it has put a value in the field GO that it does not correspond.

Example
Identifying - description - date
1 - football - 01/01/2008
empty - basketball - forgot me to put the date

ON HAVING GONE ON TO THE FOLLOWING RECORD IT GIVES ME A MISTAKE, THEN I GO OUT TO THE COUNTRY AND INTRODUCE THE DATE

3 - basketball - 12/12/2008

It is to say, me the value has put 3 instead of the value 2.

Has this solution??

Thank you.
jpiaya
Posted: Thursday, July 10, 2008 2:18:40 PM
Rank: Newbie

Joined: 7/10/2008
Posts: 3
Points: 9
I am working with sql server 2005 express

This happens to me when I insert a record from the Management Studio, when I select the table and say To open.
Scott Whigham
Posted: Friday, July 11, 2008 4:40:28 PM


Rank: Super Mod

Joined: 3/20/2006
Posts: 345
Points: 748
Location: Dallas, TX
Hi there -

First: it's supposed to be that way; there is no "fixing it"

Second: if you need numbers in a sequence, do not use an IDENTITY column.

I think what you have is a design flaw since you cannot do what you seem to want to do using an IDENTITY column. Typically we use an IDENTITY column as a primary key identifier and nothing more; we don't care about *what* it's value is, just that it is unique in the table. Anytime you need something other than this then an IDENTITY column is not what you need!
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
     
Don't Forget!
LearnItFirst.com
Don't Forget!
LearnWindows2003.com
 
Home | About Us | Support | Contact Us | Privacy | Site Map | Blogs Blogs Refer a Friend and Get a Free Subscription!
© Copyright 2004-2007 LearnItFirst.com LLC. All rights reserved. All trademarks remain the property of their respective owners.
This site is not affiliated in any way with the Microsoft Corporation.