SunQuest
 
           Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old March 13th, 2003, 02:11 AM
jeffrey jeffrey is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 4 jeffrey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Exclamation Identity Key Reused

I used identity key in my table. The key is set to increment by 1. If I delete one record, the number will be deleted also. This action will left the number not in full sequence. for example "1,2,4,5,...". The number 3 is missing.

The question is whether the number 3 for the identity key will be reused by the new inserted record? If yes, then when it happen?

Reply With Quote
  #2  
Old March 14th, 2003, 03:25 PM
numbernine numbernine is offline
Up To His Eyes In Ads
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Chicago
Posts: 160 numbernine User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 25 sec
Reputation Power: 6
Nope, next record will be 6. You won't see another 3.

Reply With Quote
  #3  
Old March 14th, 2003, 11:49 PM
jeffrey jeffrey is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 4 jeffrey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Lightbulb What is the maximum number?

What is the maximum number of the identity key, let said data type is integer? There must be a maximum number and the identity key will not increment anymore. At this time, do MSSQL Server 2000 will automatically reuse the deleted number to continue?

Reply With Quote
  #4  
Old March 15th, 2003, 05:32 AM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Location: Sydney, AU
Posts: 2,058 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 6 m 11 sec
Reputation Power: 8
Send a message via ICQ to stumpy Send a message via MSN to stumpy
all platforms have a limit on the size of a value you can store in a datatype. On a Wintel platform, an INT (2^31-1) is roughly 4 billion. Keep in mind, that this number starts from -2.1 billion. So essentially, if you start from 0, as most people do, you will only get 2.1 billion primary keys out of your int. Once you hit that limit, you will get an overflow error.

If you're just starting out programming, i would STRONGLY recommened reading up on datatypes before you jump in.

re: "trying to fill the gaps": http://www.sqlteam.com/item.asp?ItemID=4123

Reply With Quote
  #5  
Old March 16th, 2003, 10:00 AM
jeffrey jeffrey is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 4 jeffrey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks for the answer. Then there are a conclusion that MSSQL Server 2000 cannot automatically reused the identity key without interupt from human. Do I concluded right?

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft SQL Server > Identity Key Reused


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway