You need to add a constraint to a better named table:
ALTER TABLE YourSchema.YourTable ADD CONSTRAINT CHK_YourTable_YourColumn_ValidLimits CHECK(YourColumn BETWEEN 1 AND 5)
In the CREATE TABLE statement, do the following:
CREATE TABLE YourSchema.YourTable(YourColumn INT NOT NULL CONSTRAINT CHK_YourTable_YourColumn_ValidLimits CHECK(YourColumn BETWEEN 1 AND 5), SomeOtherColumns VARCHAR(10) );
The best practice is to explicitly state your limitations.
AK
source share