• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 301
  • Last Modified:

how to control the values of a field to yes or no

how to control the value of a field so that on ly yes or no can be entered.
0
kat50
Asked:
kat50
2 Solutions
 
Kevin CrossChief Technology OfficerCommented:
kat50,

Hi.  You could simply make this a bit field or you can use a constraint checking if value of column is IN ('Yes', 'No').  You can get more information on constraints using the BOL.

Hope that helps!
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
actually, as "yes/no" field shall be a BIT (0 and 1 values allowed only)
if the field is varchar indeed, the CHECK constraint can do, but note that indeed you will use 2 or 3 bytes to store an information that would use 1 bit (aka 1 byte max if there are not other bit columns) ....
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now