CREATE TABLE TBL_CD(
CDnr int identity(1,1),
CDTitel nvarchar(80) NOT NULL,
CDduur int,
CDprijs smallmoney,
所以我正在创建这个表,有什么办法可以将CDprijs的值限制在0到100之间吗?
答案 0 :(得分:8)
添加检查约束:
CREATE TABLE TBL_CD(
CDnr int identity(1,1),
CDTitel nvarchar(80) NOT NULL,
CDduur int,
CDprijs smallmoney,
check (CDprijs between 0 and 100),