Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2011-03-20
2
Medium Priority
?
299 Views
Last Modified: 2012-05-11
how to control the value of a field so that on ly yes or no can be entered.
0
Comment
Question by:kat50
2 Comments
 
LVL 60

Accepted Solution

by:
Kevin Cross earned 1000 total points
ID: 35175069
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
 
LVL 143

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 1000 total points
ID: 35175092
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

782 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question