469,091 Members | 1,154 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,091 developers. It's quick & easy.

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 1297
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
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.