您可以在列上使用检查约束。IIRC的语法如下:
create table foo ( [...] ,Foobar int not null check (Foobar > 0) [...])
如下图所示(感谢Constantin),您应该在表定义之外创建检查约束,并为其赋予一个有意义的名称,这样就很明显将其应用于哪一列。
alter table foo add constraint Foobar_NonNegative check (Foobar > 0)
您可以从以下位置的系统数据字典中获取检查约束的文本
sys.check_constraints:
select name ,description from sys.check_constraints where name = 'Foobar_NonNegative'



