1
Consider table "A" and "B".
Table "B" has a Foreign Keys for table "A".
Table "A" has no Foreign Keys.
None of the tables have records.
When trying to make a trucate to table "A", the following error is returned:
Cannot truncate a table referenced in a Foreign key Constraint (
bd
.B
, CONSTRAINTFK_1E45D7B68A6FD59C
FOREIGN KEY (a_id
) REFERENCESbd
.A
(id
))
If there is nothing in the tables, because the error occurs?
Why you want to truncate an empty table?
– Marco Aurélio Deleu
@Marcoauréliodeleu is an automatic import script, if something goes wrong, the script runs again and all inserted records are deleted. I didn’t put that in the question because it doesn’t help solve the problem.
– Filipe Moraes