FIX: Unable to Truncate a Table That Had a Constraint Defined

ID: Q156287


The information in this article applies to:
  • Microsoft SQL Server versions 6.0, 6.5

BUG #: 15572 (6.0), 15405 (6.5)

SYMPTOMS

The TRUNCATE statement fails with the following error message:

Msg 4712, Level 16, State 1
Cannot truncate table '<tablename>' because it is being referenced by a
foreign key constraint.

Deleting from the table produces the following error:
Msg 439, Level 16, State 1
Unable to find foreign key constraints for table '<tablename>' in dbid
'x' though table is flagged as having them.


WORKAROUND

To work around this problem, do the following:

  1. Back up the database.


  2. Drop and re-create the table.



STATUS

Microsoft has confirmed this to be a problem in Microsoft SQL Server versions 6.0 and 6.5. This problem has been corrected in U.S. Service Pack 2 for Microsoft SQL Server version 6.5. For more information, contact your primary support provider.


MORE INFORMATION

This problem occurs if the table once had a constraint defined, but the constraint was later removed by the ALTER statement.

Keywords : kbnetwork SSrvDRI kbbug6.50 kbbug6.00 kbfix6.50.sp2
Version : 6.0 6.5
Platform : WINDOWS
Issue type :


Last Reviewed: April 2, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.