Field attributes in SQL

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
You can try setting a CHECK Constraint:

CONSTRAINT CK_Field CHECK (Field < 100000000)
 
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.
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top