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

前端 未结 12 2050
无人及你
无人及你 2020-12-17 15:33

Say I have a table variable:

DECLARE @MyTableVar TABLE (ID INT IDENTITY(1,1), SomeData NVARCHAR(300))

After I have inserted 250 rows, I nee

12条回答
  •  没有蜡笔的小新
    2020-12-17 15:40

    If you are using SQL Server then use this DBCC CHECKIDENT('Customer', RESEED, 0) Where Customer is a table name. When you insert records into table after this command your primery key column value will be start from 1 again.

    Read this http://codedotnets.blogspot.in/2012/09/how-to-reset-identity-in-sql-server.html

提交回复
热议问题