自动编号字段 [英] Auto number fields
本文介绍了自动编号字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在SQL Server 2008表中有一个字段,该字段的自动编号增量为1,并且其中有超过100,000条记录.
I have a field in my SQL Server 2008 table that is auto number incremental of 1 and has over 100,000 records in it.
此刻我们正在迁移服务器,因此我正在做一些春季大扫除,并将删除该表中的所有记录.
We are migrating servers at the moment so I'm looking at doing a little spring cleaning and will be deleting all the records from this table.
我仍然希望自动增加1个设施的自动编号,但是我想从102001年开始的第一条记录是可能的.
I still want the auto number incremental of 1 facility but I would like the first record to start at 102001, is this possible.
谢谢.
推荐答案
是的,只需设置身份作为您选择的号码.语法:IDENTITY (seed,increment)
Yes, simply set the start value of IDENTITY to be your chosen number. Syntax: IDENTITY (seed,increment)
CREATE TABLE Customers
(
CustomerID int IDENTITY(102001, 1),
Name nvarchar(MAX)
)
这篇关于自动编号字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文