SQL约束minvalue / maxvalue? [英] SQL constraint minvalue / maxvalue?
本文介绍了SQL约束minvalue / maxvalue?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有一种方法可以为数字字段设置SQL约束,最小值应为1234,最大值应为4523?
解决方案
创建表号(
/ pre>
number int not null
check(number> = 1234 and number< = 4523),
...
)
创建表号(
number int not null,
check(number> = 1234 and number< = 4523),
...
)
创建表号(
number int not null ,
constraint number_range_check
check(number> = 1234 and number< = 4523),
...
)
Is there a way to set a SQL constraint for a numeric field that min value should be 1234 and max value should be 4523?
解决方案SQL Server syntax for the
check
constraint:create table numbers ( number int not null check(number >= 1234 and number <= 4523), ... ) create table numbers ( number int not null, check(number >= 1234 and number <= 4523), ... ) create table numbers ( number int not null, constraint number_range_check check(number >= 1234 and number <= 4523), ... )
这篇关于SQL约束minvalue / maxvalue?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文