Technical Article

Truncate tables with foreign keys

Truncating tables with constraints always had been a pain, since we have to drop and recreate all the FKs. I created a script that takes care of dropping and recreating the foreign keys while truncating. Please use with caution! and always respect your Data !

(3)

You rated this post out of 5. Change rating

2016-12-01 (first published: )

1,385 reads

Blogs

T-SQL Tuesday #201 Round-Up: Temp Tables, Friend or Foe?

By

The T-SQL Tuesday #201 round-up: nine bloggers on whether temp tables are a friend...

Monday Monitor Tips: Configuring Access to the MCP Server

By

I have been experimenting with MCP servers in a few ways, including the Redgate...

The GO Barrier: Why SSMS Multi-Server Query Waits for the Slowest Connection

By

I deployed a schema change to 30 servers using multi-server query and deploy-at-low-priority. Small...

Read the latest Blogs

Forums

Column Data Types

By Artur Sanin

Comments posted to this topic are about the item Column Data Types

A Challenge of Our Knowledge

By Steve Jones - SSC Editor

Comments posted to this topic are about the item A Challenge of Our Knowledge

The memory toll of VARCHAR(MAX) in SQL Server

By sabyda

Comments posted to this topic are about the item The memory toll of VARCHAR(MAX)...

Visit the forum

Question of the Day

Transaction Log Truncation

In SQL Server 2025, where can I find information about items that prevent or delay the transaction log truncation?

See possible answers