我希望限制数值字段可能具有的值的范围。例如。外地“年”应能在1995年至2016年期间具有价值。
在Microsoft 2012的Transact- 2012中,这是可能的吗?
发布于 2014-03-14 10:42:16
使用检查约束,如下所示:
CREATE TABLE YourTable
(
Id int not null primary key,
Year int not null check (Year >= 1995 AND Year <= 2016)
)
https://stackoverflow.com/questions/22413147
复制