Solved

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

Posted on 2011-03-20
2
289 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 142

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

757 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now