Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Rebuild relationships
Message
 
 
To
19/09/2005 15:29:51
Joel Hokanson
Services Integration Group
Bellaire, Texas, United States
General information
Forum:
Microsoft SQL Server
Category:
Database design
Miscellaneous
Thread ID:
01037208
Message ID:
01051008
Views:
10
>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--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform