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

  • Home
  • SEARCH
  • 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 3390990
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T03:45:15+00:00 2026-05-18T03:45:15+00:00

When I right click on a default constraint and I ask SQL Server to

  • 0

When I right click on a default constraint and I ask SQL Server to create a CREATE script for it, it generates the following code:

ALTER TABLE [dbo].[tblEventTurnJudgeStartValues]  WITH NOCHECK ADD  CONSTRAINT [tblEventTurnJudgeStartValues_ExecutionToggle] CHECK  (([ExecutionToggle]=(1) OR [ExecutionToggle]=(0) OR [ExecutionToggle]=(-1)))
GO
ALTER TABLE [dbo].[tblEventTurnJudgeStartValues] CHECK CONSTRAINT [tblEventTurnJudgeStartValues_ExecutionToggle]

For the record, I understand the first ALTER statement but I do not understand what the the second alter statement does. Tried to google the “CHECK CONSTRAINT” phrase but only got hits on the add constraint syntax.

Thanks.

Seth

update
Thanks Joe for your answer. Found this link which helps.

http://blog.sqlauthority.com/2009/11/12/sql-server-disable-check-constraint-enable-check-constraint/

I did not know that you could enable and disable constraints. Cool!

Seth

  • 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-05-18T03:45:16+00:00Added an answer on May 18, 2026 at 3:45 am

    The first statement creates the constraint, but since it is created with NOCHECK, existing data is not validated at the time of creation.

    The second statement simply turns the constraint on and is technically redundant.

    Personally, I’d prefer the second statement be written with the WITH CHECK option, which will validate all existing data against the constraint and will prevent the constraint from becoming untrusted.

    ALTER TABLE [dbo].[tblEventTurnJudgeStartValues] WITH CHECK CHECK CONSTRAINT [tblEventTurnJudgeStartValues_ExecutionToggle]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I use the following code I lose the ability to right click on
I want to create a right click context menu for my textboxes to provide
I'm currently doing the following to use typed datasets in vs2008: Right click on
In MVC 1 in VS2008, you could right click the Default.aspx page and set
When I right-click a solution in VS2008 and select Check In... I am presented
I used to be able to right click Folders in my project and click
Is there a way to detect a right click followed by paste with JavaScript
In the library, right-click on a movieclip that you have written an ActionScript class
When developing in a VS2005+ with C# project and I right click on a
I think most people know how to do this via the GUI (right click

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.