Scripts

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,314 reads

Technical Article

Generate add / alter script for missing / different type columns

This query generate add/alter script for missing or different columns. Execute on source database and copy resultset. Execute generated script on any database (may be all customer databases) Missing columns will be created and different types will change as source schema.

4 (4)

You rated this post out of 5. Change rating

2016-11-18 (first published: )

872 reads

Blogs

2024 PASS Data Community Summit Prep

By

Next week is the 2024 PASS Data Community Summit in Seattle. I’ll be traveling...

A New Word: Bye-over

By

bye-over – n.  the sheepish casual vibe between two people who’ve shred an emotional...

Free webinar – Tackling the Gaps and Islands Problem with T-SQL Window Functions

By

I’m hosting a free webinar at MSSQLTips.com at the 19th of December 2024, 6PM...

Read the latest Blogs

Forums

PASS Summit Time

By Louis Davidson (@drsql)

Comments posted to this topic are about the item PASS Summit Time

database restore chain

By sqlfriend

I have a backup of full, differential and transaction log setup for our database....

Temporary Table Problem

By fk.da

Hello everyone, I hope you can help me. I have a table with measurement...

Visit the forum

Question of the Day

Incremental Statistics

I have run this on SQL Server 2022 for the Sales database:

ALTER DATABASE Sales SET AUTO_CREATE_STATISTICS ON (INCREMENTAL = ON)
I then run this in the Sales database:
USE Sales
GO
CREATE STATISTICS CustomerStats1 ON dbo.Customer (CustomerKey, EmailAddress) WITH INCREMENTAL = OFF
The dbo.Customer table is partitioned. How are statistics created?

See possible answers