开发者

Regarding Clearing Auto Increment Value For Sql Table Variable [duplicate]

This question already has answers here: Closed 11 years ago.

Possible Duplicates:

How can I reseed an identity column in a T-SQL table variable?

Is there anyway to reset the identity of a Table Variable?

Please go through the below sample and clarify my Question ?

Declare @temp table (sno int identity, myname varchar(30))
insert into @temp开发者_如何学JAVA (myname) values ('Ravi')
insert into @temp (myname) values ('visu')
insert into @temp (myname) values ('pranesh')

delete from @temp

insert into @temp (myname) values ('Ravi')

select * from @temp

I am inserting 3 values in @temp table which has auto increment. And later deleting the Value. Immediately adding another value. In this the Auto increment value id jumped to 4. I need to clear the auto increment value with out using dbcc statement.

Can anyone help me ? Your suggestions are highly appreciated. Thank You.


You cannot insert explicit values into an identity column for table variable

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜