>I think it turns out that EXEC sp_MSforeachtable @command1="ALTER TABLE ? NOCHECK CONSTRAINT ALL"
>Will only work for adds and updates but NOT for truncate table. So the error is the same if you specify NOCHECK or not (prevented by constraints from other files).
>
>Query Analizer Results
>Run:
>EXEC sp_MSforeachtable @command1="ALTER TABLE ? NOCHECK CONSTRAINT ALL"
>
>TRUNCATE TABLE dbo.QM_EQUIPMENT
>
>Results Window:
>Server: Msg 4712, Level 16, State 1, Line 3
>Cannot truncate table 'dbo.QM_EQUIPMENT' because it is being referenced by a FOREIGN KEY constraint.
Hi Joel,
I don't know what I was thinking but TRUNCATE TABLE doesn't work on the tables referenced by a FOREIGN KEY constraint. Sorry about that. I'm not aware about easy way to DROP and than restore the FOREIGN KEY constraints.
--sb--