Forcing specific values for a field

  • I want to create a table with a "priority" field in it. This field is a character type but I ONLY want 3 values allowed to be entered in this field.

    "High","Medium","Low"

    I'm not so sure this can be done at the field level in Sql Server but have seen it done using other DB's. Of course it can be easily done at data entry using code to force those values (drop down box, etc...) but just want to know if it's possible to enforce at the field level instead of having to do it with the application entry level

    Thanks

  • You could put a constraint on the field to limit what values are allowed.

    Jeremy

  • Ok, does the field HAVE to be a primary key to have a constraint on it?

  • You can put a constraint on any field - it does not have to be a primary key.

    Jeremy

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply