Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8856931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:28:12+00:00 2026-06-14T14:28:12+00:00

I am totally new to SQL Server management, I tried to add a constraint

  • 0

I am totally new to SQL Server management, I tried to add a constraint in a table.

The situation is that I created a column with only ‘Y’or ‘N’ allowed to be valued.

So I tried to create a constraint in Management Studio by right clicking “Constraints” in the table.

However, I really have no idea about the syntax of creating a constraint. Finally, I tried to input the code into “Check Constraint Expression” window by referring the template from the Internet. The SQL Server always tell me “Error Validating constaint”.

Can you guys just help me to write the first constraint for me? Because I really dont know how to start.

My requirement is:

I have a table called "Customer"
I created a column called "AllowRefund"
The column "AllowRefund" is only allowed to 'Y' or 'N'

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T14:28:13+00:00Added an answer on June 14, 2026 at 2:28 pm

    I’d advise against what you are trying to do. There is a datatype (Bit) that is designed to represent values with two states. If you use this type you won’t even need the constraint at all. SQL Server will enforce the value to be either one or zero with no additonal work required. You just have to design your app to treat 1 as yes, and 0 as No.

    The approach you are attempting is just not a good idea and no good will come of it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am totally new to SQL Server CLR. I understand that we should use
I am creating a new table in Microsoft SQL server 2000 by writing the
I'm totally confused of how to get the local sql server instance. The only
I use SQL Server and when I create a new table I make a
Totally new to Capistrano. I have a local git repository that I want to
I'm totally new to AWS. I managed to have an instance that runs PHPMyAdmin.
I'm totally new in OpenCV so hopefully that's not a too stupid question. As
Using VS2010 and SQL express 2005, Ive created a database, created a simple table,
I want to export my big SSMS (SQL Server Management Studio) query result (2.5m
I am using SQL Server 2005. I have a site that people can vote

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.