Solved

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

Posted on 2011-03-20
2
292 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 59

Accepted Solution

by:
Kevin Cross earned 250 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 250 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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 …
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

808 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