FIX: INSERT Statement Incorrectly Conflicts with Constraint

Article translations Article translations
Article ID: 279804 - View products that this article applies to.
This article was previously published under Q279804
BUG #: 351128 (SHILOH_bugs)
Expand all | Collapse all

SYMPTOMS

After you create a constraint on a table that checks multiple columns using a combination of NOT and AND operators, valid inserts into the table may be rejected. The insert may fail with an error message similar to the following:
Server: Msg 547, Level 16, State 1, Line 1
INSERT statement conflicted with TABLE CHECK constraint 'tbl_temp'. The conflict occurred in database 'tempdb', table '#temp____________________________________________________________000000000018'.
The statement has been terminated.

RESOLUTION

To resolve this problem, obtain the latest service pack for SQL Server 2000. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
290211 INF: How to Obtain the Latest SQL Server 2000 Service Pack

STATUS

Microsoft has confirmed that this is a problem in SQL Server 2000. This problem was first corrected in SQL Server 2000 Service Pack 1.

MORE INFORMATION

Here is the script that produces the error:
DROP TABLE #temp
SET ansi_nulls OFF
GO
CREATE TABLE #temp (
                     x   CHAR(1) NOT NULL,
                     y   CHAR(1) NULL,
                     CONSTRAINT tbl_temp CHECK 
                         (NOT (y = 'P' AND x NOT IN ('R', 'T')))
   )
   go
INSERT #temp (x, y) VALUES ('A', NULL)
GO
				

Properties

Article ID: 279804 - Last Review: October 16, 2003 - Revision: 3.2
APPLIES TO
  • Microsoft SQL Server 2000 Standard Edition
Keywords: 
kbbug kbfix kbsqlserv2000sp1fix KB279804

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com