问题
I want to create a column with identity property and I want to specify its max value.
For example:
CREATE TABLE tbl (
ID int PRIMARY KEY identity(1,1)
)
I want to specify 20000 as a max value for ID.
回答1:
alter table tbl add constraint CHK_TBL_MAX_ID check (id <= 2000)
Example at SQL Fiddle.
来源:https://stackoverflow.com/questions/17652741/sql-server-set-identity-max-value