Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
swaruptkumar
Starting Member
1 Post |
Posted - 2010-06-23 : 06:23:41
|
| Hi,I'm new to sqlserver i'm facing the following issue. i have createa a table with 4 columns and i assigned identity for a column and during inserting records i made few mistakes and third time the record got inserted but the the column which i added identity updated with number (3) instead of (1). Please let me know how can i over come this.Thanks for ur patients and answers in advanceSKSwarup Kumar |
|
|
Sachin.Nand
2937 Posts |
Posted - 2010-06-23 : 06:34:09
|
| Did you delete any records?Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless. PBUH |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-06-23 : 06:38:31
|
you should not worry about gaps in the identity column. No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2010-06-23 : 06:43:30
|
| the reason is that every time you insert (even if the transaction is rolled back) the identity value is incremented.As webfred mentioned -- this shouldn't be a problem for you. You can't rely on IDENTITY to give you an unbroken sequence.Why do you think it will be an issue?Charlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION |
 |
|
|
|
|
|