Field attributes in SQL

S

Skat

Im tring to create a table in SQL, I need one of my integer fields to only
allow 8 integers to be inputted. How can I write an SQL statement for this?
Thank You
 
D

Douglas J. Steele

You can try setting a CHECK Constraint:

CONSTRAINT CK_Field CHECK (Field < 100000000)
 
V

Van T. Dinh

Perhaps, you need to clarify your question a bit more since if you want to
restrict the input value to less than 8 digits, it is a superfluous
restriction since the max / min of an integer Field in only +/- 32K, i.e.
max of 5 digits.
 
T

TedMi

It depends on what you mean by "8 integers" The numbers 1 - 8? One of an
arbitrary list of 8 integers? A number no longer than 8 decimal digits?
Please specify.
 
Top