CREATE TABLE TBL_CD(
CDnr int identity(1,1),
CDTitel nvarchar(80) NOT NULL,
CDduur int,
CDprijs smallmoney,
So I am creating this table, is there any way I can limit the value of CDprijs to be between 0 and 100?
所以我正在创建这个表,有什么办法可以将CDprijs的值限制在0到100之间吗?
1 个解决方案
#1
8
Add a check constraint:
添加检查约束:
CREATE TABLE TBL_CD(
CDnr int identity(1,1),
CDTitel nvarchar(80) NOT NULL,
CDduur int,
CDprijs smallmoney,
check (CDprijs between 0 and 100),
#1
8
Add a check constraint:
添加检查约束:
CREATE TABLE TBL_CD(
CDnr int identity(1,1),
CDTitel nvarchar(80) NOT NULL,
CDduur int,
CDprijs smallmoney,
check (CDprijs between 0 and 100),