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 4609442
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:59:14+00:00 2026-05-22T00:59:14+00:00

Does SQL Server allow constraint violations (i.e. deferred constraints) in a transaction as long

  • 0

Does SQL Server allow constraint violations (i.e. deferred constraints) in a transaction as long as the transaction has not been committed yet?

I have a running, uncommitted transaction and while this transaction is running, I will change my data so that it will violate some constraints (like having duplicate primary keys for example). When I commit the transaction, the data will be in consistent, valid state. Is this generally allowed in SQL and specifically in MS SQL Server?

  • 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-22T00:59:14+00:00Added an answer on May 22, 2026 at 12:59 am

    No, sorry. SQL Server does not allow deferred contraints in a transaction. It was present in SQL Server 6.5, but removed in SQL Server 2000:

    SET DISABLE_DEF_CNST_CHK ON
    

    Each individual statement must be consistent etc, regardless of whether it is in a transaction

    Some RDBMS do allow this (e.g. Oracle, Postgres, Interbase)

    Connect

    There is a Microsoft Connect request, created in 2006, asking for this feature:

    Option to defer foreign key constraint checking until transaction commit

    There are various “chicken and egg” scenarios where it would be desirable to defer the checking of referential integrity constraints until commit time on a transaction.

    Allow deferring of referential integrity constraint checking until commit time on a transaction (as an option). Suggest providing an option on BEGIN TRANSACTION that specifies this.

    The last response from Microsoft came a decade ago:

    Posted by Sameer [MSFT] on 10/13/2006 at 1:35 PM

    Hello Greg,

    Thanks for the feedback. We are aware of this and looking into it for a future release.

    Sameer Verkhedkar
    SQL Engine
    [MSFT]

    Which is Microsoft speak for “go away”.

    SQL-92 defines it

    The feature was defined in July 1992 with SQL-92. An example syntax would be:

    BEGIN TRANSACTION
       SET CONSTRAINTS ALL DEFERRED --applies only to the current transaction
    
       INSERT Customers ...
       INSERT Orders ...
       UPDATE Customers ... --add the thing we were missing
    
    COMMIT TRANSACTION
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given that SQL Server does not allow modification of the logical INSERTED and DELETED
Why does Sql server doesn't allow more than one IDENTITY column in a table??
How does SQL Server determine whether a table column has low cardinality? The reason
Does sql server allow nested transactions? If so then whats the priority of transactions?
Does SQL Server 2008 ship with the .NET 3.5 CLR, so that stored procedures
Does SQL Server's (2000) Soundex function work on Asian character sets ? I used
Does SQL Server 2008 have a a data-type like MySQL's enum ?
Does SQL server expect numbers to be specified with digits from the latin alphabet,
Does SQL Server 2005 maintain built-in, queryable, row-level last-modified timestamp metadata? I'm doing some
Does SQL Server maintains any history to track table alterations like column add, delete,

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.