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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Resetting auto_increment value??

Author  Topic 

goose1984
Starting Member

2 Posts

Posted - 2006-11-08 : 08:37:34
Hi

If add 3 rows to a table, the auto_increment value will be set to 4 (for the next record)... then you delete record number 3, but auto_increment value is still 4. Is there a function in MySQL that reshuffles the auto_increment value? I know in MS Access you can do the same function by "compact and repair"

I am having a debate with some friends

"You shouldn't have to worry about what the index values are. They are for use by the database to reference rows. As far as it's concerned 1 or 346 or 9765 etc is just an indentifier for the row with no other significant meaning.
It may look odd to us humans to see rows out of numerical order and rows numbered with incomplete sequences, and it may bother us more "organised" types, but it really makes no difference to the database."

Could you please tell me your view on and and whether it is possible?

Cheers

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-11-08 : 08:39:59
Take a look at DBCC CHECKIDENT in BOL

Also search this site for Surrogate Key for your second question.

Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

blindman
Master Smack Fu Yak Hacker

2365 Posts

Posted - 2006-11-08 : 09:53:22
quote:
Originally posted by goose1984

"You shouldn't have to worry about what the index values are. They are for use by the database to reference rows. As far as it's concerned 1 or 346 or 9765 etc is just an indentifier for the row with no other significant meaning."

Absolutely agree. Surrogate keys, by definition, have no inherent relation to their data, and by trying to use them to indicated the order of the data you are violating this principle.

STAR SCHEMAS ARE NOT DATA WAREHOUSES!
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-11-08 : 09:57:49
quote:
Originally posted by blindman

STAR SCHEMAS ARE NOT DATA WAREHOUSES!
Star schemas are Celebrity Mansion Maps in Los Angeles?


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -