Microsoft KB Archive/246323: Difference between revisions
(importing KB archive) |
m (Text replacement - ">" to ">") |
||
Line 62: | Line 62: | ||
go | go | ||
ALTER TABLE dbo.test5 ADD CONSTRAINT | ALTER TABLE dbo.test5 ADD CONSTRAINT | ||
CK_test5 CHECK NOT FOR REPLICATION ((abc | CK_test5 CHECK NOT FOR REPLICATION ((abc>0)) | ||
</pre></li> | </pre></li> | ||
<li><p>Insert a new row:</p> | <li><p>Insert a new row:</p> |
Revision as of 09:43, 21 July 2020
Article ID: 246323
Article Last Modified on 3/14/2006
APPLIES TO
- Microsoft SQL Server 7.0 Standard Edition
This article was previously published under Q246323
BUG #: 56174 (SQLBUG_70)
SYMPTOMS
When a table is created with check constraint and the constraint is set as "NOT FOR REPLICATION", the constraint is not enforced even though the value entered is outside the range of the check constraint. For example:
Create a table with check constraint not for replication:
use pubs go CREATE TABLE dbo.test5 ( abc int NOT NULL ) ON [PRIMARY] go ALTER TABLE dbo.test5 ADD CONSTRAINT CK_test5 CHECK NOT FOR REPLICATION ((abc>0))
Insert a new row:
INSERT INTO pubs..test5 (abc) VALUES (1)
Update the same row:
UPDATE pubs..test5 SET abc=-1 WHERE abc=1
The preceding update should create this error:
On the contrary, the preceding update is actually successful.
WORKAROUND
Do not use the "NOT FOR REPLICATION" option on CHECK CONSTRAINT.
STATUS
Microsoft has confirmed this to be a problem in SQL Server 7.0. This problem has been corrected in U.S. Service Pack 2 for Microsoft SQL Server 7.0. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
254561 INF: How to Obtain Service Pack 2 for Microsoft SQL Server 7.0 and Microsoft Data Engine (MSDE) 1.0
For more information, contact your primary support provider.
MORE INFORMATION
Also, when you trying to change the value in the preceding example back to a value that is within the range as in this example:
UPDATE pubs..test5 SET abc=1 WHERE abc=-1
You may see this error message:
Keywords: kbbug kbfix KB246323