PRB: Constraint Violation Is Not Detected If Update with the Same Data (238146)
The information in this article applies to:
- Microsoft SQL Server 7.0
- Microsoft SQL Server 2000 (all editions)
This article was previously published under Q238146
BUG #: 56110 (SQLBUG_70)
BUG #: 212952(SHILOH)
SYMPTOMS
In SQL Server 7.0 or later, you do not receive an error message if you perform an update by setting a column to itself against a table that contains FOREIGN KEY constraint violation data. However, in SQL Server 6.5, you receive the following error:
547 16 UPDATE statement conflicted with COLUMN FOREIGN KEY constraint
'%.*s'.The conflict occurred in database '%.*s', table '%.*s'
CAUSE
This is by design. SQL Server 7.0 or later no longer updates a column with the same value because the "key" is not changing.
WORKAROUND
To work around this problem, explicitly re-enable constraints, as in the following example:
ALTER TABLE titleauthor with check check constraint all
go
Modification Type: | Major | Last Reviewed: | 10/28/2003 |
---|
Keywords: | kbBug kbpending kbprb KB238146 |
---|
|