T-SQL Tuesday #104 – My Undercover Toolbox favourites


This months T-SQL Tuesday is being hosted by Bert Wagner , you can find the invitation for this months topic here.

Bert has a great topic for this month, he wants us to write about code you’ve written that you would hate to live without.

I have found the SQL server community to be extremely helpful especially when it comes to finding good code sources, these sources have inspired me to write my own code and to also share with the community ,not sure if any of it actually gets used 😛

Here is some code I have written that helps us get by on a daily basis, I have narrowed my list down to four of my own but we do have lots more available such as @dbadavidfowler fantastic sp_restorescript with more code due to hit our Github repo.


SQLUndercover Inspector: 

2018-01-22 14_44_08

We receive an email from the Inspector every morning for each SQL stack, its a great place to start for a quick visual of the housekeeping type tasks all in one place.

One of my favourite parts of the Inspector is the drive space usage module, it helps us keep on top of drive space usage and helps predict how long it will be until the disks are full, it also includes a last 5 days of usage which can be really handy for a glance when things have taken a sudden spike within the last few days.

2018-07-09 21_15_01

Currently I am working on V1.2 for the Inspector which can be found on our Git Projects page

If you would like to know more about the Inspector please check out the following blog posts:


Getting started

If you have some good ideas for things you would like to see included in the Inspector or would like to contribute code please head over to our GitHub Repo and raise an issue , we would love to hear from you 🙂




2017-12-07 21_51_29-DC01A [Running] - Oracle VM VirtualBox

2018-02-08 20_17_07-DC01 on CATACLYSM - Virtual Machine Connection

This is a great goto proc for an alternative to the Always on availability group GUI for changing Failover mode, Synchronous mode or even Readable options.

When you manage multiple servers with multiple Availability groups this stored procedure can save you alot of time, sometimes I find the GUI can take a long time to open but equally it can take some time to execute the command.

sp_AGreconfigure can speed this process up for you, we tend to use this as our goto for switching synchronous settings when patching/rebooting replicas but also I tend to use it in @Checkonly = 1 mode for giving the Availability group settings a once over.

For more details on the procedure can be found here



2017-07-27 22_14_44-SQLQuery2.sql - LAPTOP-ADRIANB_SQLDEV2.master (ADASTRA_buckmana (53))_ - Microso

I decided to write sp_Runningjobs because when I need to check for running jobs across multiple servers I can simply run this stored procedure against my registered servers list which makes checking so much faster than opening up the job activity monitor on each server individually,  More info can be found here



2018-07-09 22_07_09

A quicker way of checking the error log for failed logins 🙂 more info can be found here


Thank you for reading 🙂






2 thoughts on “T-SQL Tuesday #104 – My Undercover Toolbox favourites

Add yours

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: