472,111 Members | 1,860 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,111 software developers and data experts.

Data Of AutoGenerate ID Columns Of Sql-2000 Server

maheshwag
I have a table as below:

Table : Dummy

ACID int, // Autoincrement Columns with Primary Key
Accname Varchar(100)

The ACID of Dummy Table are always increase the value, it’s fine. But the problem is that it’s continue the ID No. after deletion. e.g.:

Expand|Select|Wrap|Line Numbers
  1.  
  2. ACID       accname
  3. -----------------
  4. 1    mahesh
  5. 2    mahendra
  6. 3    kirti
  7.  
  8.  
  9.  

Now I deleted the above data from table and if I try to insert the new data on table than ACID start ID from No. “4” instead of No. “1”.
What to do for start ID at No. “1” again after deletion of old records from the table?
Apr 30 '11 #1

✓ answered by ck9663

Be careful of doing this. If your ACID is related to any other table, you might loose the relationship between the two tables.

What you are looking for is to reseed your identity value. For that, you can start reading this. If you just want to start from 1, use truncate table, not delete.

Good Luck!!!

~~ CK

1 1332
ck9663
2,878 Expert 2GB
Be careful of doing this. If your ACID is related to any other table, you might loose the relationship between the two tables.

What you are looking for is to reseed your identity value. For that, you can start reading this. If you just want to start from 1, use truncate table, not delete.

Good Luck!!!

~~ CK
May 2 '11 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by Jennifer Smith | last post: by
reply views Thread by GreenFROG Design | last post: by
3 posts views Thread by markaelkins | last post: by
1 post views Thread by ypul | last post: by
2 posts views Thread by hazz | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.