Disable Foreign key constraint on all tables didn't work ?
- by Space Cracker
i try a lot of commands to disable tables constraints in my database to make truncate to all tables but still now it give me the same error
Cannot truncate table '' because it is being referenced by a FOREIGN KEY constraint.
i try
EXEC sp_msforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all"
EXEC sp_MSforeachtable "TRUNCATE TABLE ?"
and i tried this for each table
ALTER TABLE [Table Name] NOCHECK CONSTRAINT ALL
truncate table [Table Name]
ALTER TABLE [Table Name] CHECK CONSTRAINT ALL
and every time i have the previous error message .. could any please help me to solve sucha a problem ?