Click to See Complete Forum and Search --> : Identity Column in MSSQL 2000


erickwidya
November 3rd, 2006, 04:17 AM
i have an identity column with value 1, 2, 3

if i delete the #3..the new record will inserted using 4 as the identity..

is there a way to use 3 as the identity since it's not there yet?
and if i delete all records in that table..the new record will inserted using 4 too as the identity..is there a way for this one to so it will using 1 as the identity?

in Access we can use Compact and Repair for question no. 2 but this in MSSQL 2000

thanks,

umararif
November 3rd, 2006, 05:10 AM
use following query for insertion at your front-end.

--SQL statement
insert into table ([identity column]
select max([identity column])+1 from table

umar

erickwidya
November 3rd, 2006, 08:30 PM
thx umararif but i'm afraid that's not what i mean

i already found an answer..

use DBCC CheckIndent

see BOL for further explanation

thx