SQL Interview: 90 Truncate table failing

SQL Interview: 90 Truncate table failing

This is a post in the SQL Interview series. These aren’t trick or gotcha questions, they’re just questions designed to scope out a candidate’s knowledge around SQL Server and Azure SQL Database.

Section: Administration Level: Medium

Question:

You are trying to truncate a table but the command is failing.

Can you give some examples of what can cause a truncate command on a table to fail?

Answer:

One common reason is that the table is referenced by a FOREIGN KEY constraint. (But you can truncate a table that has a foreign key that references itself).

Other common reasons:

  • Table is part of an indexed view
  • Table is published by using transactional or merge replication
  • Table is a system-versioned temporal table
  • Table is referenced by an EDGE constraint

2025-10-31