Scripts

PowerShell script to create SQL Server alias name

This script is useful for your environment having multiple always-on with replication setup and your listener value is persisted with RegisterallIP set to 1. When initiating the always-on failover, It will create/update the alias in the distributor server by pointing to the new primary server without RDP to each distributor server and that makes the […]

2021-07-07 (first published: )

380 reads

How to shrink tempdb database in SQL Server

This article discusses different methods that you can use to shrink the tempdb database in Microsoft SQL Server. Before you shrink the tempdb database using the methods described in this article, note the following: The tempdb size is reset to the final configured size (i.e. to the default size or the final size that was […]

2021-06-09

327 reads

Space allocated to the databases by disk letters

Found this useful for database migrations. This helps to identify how much space will need to be allocated for a new server and how a SQL Sever instance is using discs currently. Note. This won't show correct information on Linux instances and if you use mounting points in Windows.

5 (1)

2021-04-23 (first published: )

495 reads

Execute on DMVs without user having View Server State

Wanted to share this script to the community just in case anyone out there may be search for a way to allow a hosted customer the ability to query certain DMVs for information without granting them View Server State. There are some other options out there, but this worked better for me after going through […]

5 (1)

2020-09-24

817 reads

Fiscal/Retail 4-5-4 Calendar Function

This function returns a 3 year calendar based on a 4-5-4/5-4-4/4-4-5 calendar, also known as a 52/53 week calendar.  The basis of this calendar function was derived from the NRF retail calendar published at https://nrf.com/resources/4-5-4-calendar and the Wikipedia article published at https://en.wikipedia.org/wiki/4%E2%80%934%E2%80%935_calendar. The calendar function requires 2 helper functions.  The helper functions were derived from […]

2020-09-21 (first published: )

898 reads

Blogs

Removing a Deleted Column from a Data Masker Masking Set

By

Data Masker for SQL Server is a great tool ensuring the data you use...

Containers: A Short Rant

By

I find myself doing more and more work with containers. Yet, I also find...

Daily Coping 20 Sep 2021

By

I started to add a daily coping tip to the SQLServerCentral newsletter and to...

Read the latest Blogs

Forums

Metadata-Data-Ratio in a table

By sean redmond

Hi all, My understanding about the structure of data within SQL Server is that...

Always On - why No failover occurred?

By onlo

Hi, I am using SQL 2016 (13.0.5888.11). Last Saturday (18th September), in non-office hours,...

Log Shipping Truncate Log File

By coolchaitu

Good Morning, I have read that taking a log backup truncates the log file....

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers