[dba-SQLServer]basic question

Billy Pang tuxedo_man at hotmail.com
Wed Mar 19 14:25:28 CST 2003


For example:

/* -- cut here -- */
use tempdb
begin tran
set nocount on
create table aaa(aaa_id int identity(1,1), aaa_value char(1));
insert into aaa(aaa_value) values('x')
insert into aaa(aaa_value) values('x')
insert into aaa(aaa_value) values('x')
go
select * from aaa
go
delete from aaa where aaa_id  = 3;
go
declare @i int
select @i = max(aaa_id) from aaa
DBCC CHECKIDENT(aaa, reseed, @i)
go
insert into aaa(aaa_value) values('x')
insert into aaa(aaa_value) values('x')
go
select * from aaa
set nocount off
rollback
/* -- cut here -- */






>From: "Billy Pang" <tuxedo_man at hotmail.com>
>Reply-To: dba-sqlserver at databaseadvisors.com
>To: dba-sqlserver at databaseadvisors.com
>Subject: Re: [dba-SQLServer]basic question
>Date: Wed, 19 Mar 2003 20:14:30 +0000
>
>Look up DBCC CHECKIDENT in BOL
>
>Billy
>
>
>>From: "Susan Harkins" <harkins at iglou.com>
>>Reply-To: dba-sqlserver at databaseadvisors.com
>>To: "SQLList" <dba-SQLServer at databaseadvisors.com>
>>Subject: [dba-SQLServer]basic question
>>Date: Tue, 18 Mar 2003 19:39:37 -0500
>>
>>In Access, a compact will reset the AutoNumber seed value to one more than
>>the largest AN value already in the table. Is there anyway to do this with
>>an Identity column in SQL Server?
>>
>>Susan H.
>>
>>_______________________________________________
>>dba-SQLServer mailing list
>>dba-SQLServer at databaseadvisors.com
>>http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
>>http://www.databaseadvisors.com
>>
>
>
>_________________________________________________________________
>Add photos to your e-mail with MSN 8. Get 2 months FREE*.  
>http://join.msn.com/?page=features/featuredemail
>
>_______________________________________________
>dba-SQLServer mailing list
>dba-SQLServer at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
>http://www.databaseadvisors.com
>


_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.  
http://join.msn.com/?page=features/virus




More information about the dba-SQLServer mailing list