Truncate

Technical Article

Truncate tables with foreign keys

  • Script

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.67 (3)

You rated this post out of 5. Change rating

2016-12-01 (first published: )

1,270 reads

Blogs

Elevate Your Data Leadership: A Unique Intensive Learning Experience

By

I’ve collaborated with two industry experts to design a transformative course for data leaders:...

A New Word:Maugry

By

maugry – adj. afraid that you’ve been mentally deranged all your life and everybody...

Friday Flyway Tips–Capture the Filegroup for Tables

By

A customer asked recently why Flyway doesn’t detect the filegroup for some changes. I...

Read the latest Blogs

Forums

Improve Delete Performance in Table With Many Related Tables

By tgitchel

This simple delete statement drives CPU to 100% for long periods of time when...

Transpose table by Row number

By scott@lucsam.com

I want to transpose the attached table of data so that all the data...

Visual Design for Safety

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Visual Design for Safety

Visit the forum

Question of the Day

A New Audit

I have a brand new D: drive on my system that is formatted, but contains no files or folders. What happens when I execute this code?

CREATE SERVER AUDIT audit2 TO FILE ( FILEPATH ='D:\audit' );
GO

See possible answers