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

You rated this post out of 5. Change rating

2016-12-01 (first published: )

1,271 reads

Blogs

A First Look at Redgate’s Subsetter

By

I have been a proponent of subsetting databases in dev/test for a long time....

Azure SQL MI License free?

By

A common setup when leveraging the cloud is to use the cloud for Disaster...

Foreign Keys in SQL Data Generator

By

A customer recently asked about using FKs in SQL Data Generator, and I decided...

Read the latest Blogs

Forums

The Ultimate Guide To Selecting the Best Assignment Writing Service

By jenniferlois

When it comes to selecting the best Assignment Writing Service, students often face difficulty...

The Ultimate Guide To Selecting the Best Assignment Writing Service

By jenniferlois

When it comes to selecting the best Assignment Writing Service, students often face difficulty...

Using AI for Security

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Using AI for Security

Visit the forum

Question of the Day

Writing to Clones

I run this code on SQL Server 2019:

DBCC CLONEDATABASE(imdb, imdb_dev)
I then change to the cloned database, imdb_dev, and run some queries. I then run this code while testing:
INSERT dbo.Title (TitleID, Title, DateReleased) VALUES (3234, 'Maestro', '2023')
GO
What happens?

See possible answers