If a table is referenced by other table. We can’t truncate this table directly.
There are two ways to Truncate records from referenced table.
First way
- Delete all records with delete command.
- Reset the table identity.
Second Way
- Remove foreign key constraint.
- Truncate table.
- Apply foreign key constraint again.