title: How to delete or truncate table in SQL Server?
body: <p>I need to clear many tables (preferably truncate table). But tables have many FK constraints. I tried something like this, but failed:-</p>
  
  <pre><code>ALTER TABLE Table1 NOCHECK CONSTRAINT ALL 
  TRUNCATE TABLE Table1
  ALTER TABLE Table1 WITH CHECK CHECK CONSTRAINT ALL
  </code></pre>
  
  <p>This is the error i am getting:-</p>
  
  <p>Cannot truncate table 'Test' because it is being referenced by a FOREIGN KEY constraint.</p>
  
  <p>Please suggest me how to delete or truncate table by dropping constraints temporarily.</p>