Set Max Database Size in SQL Server
February 21, 2019
Setting Maximum Database File Sizes in SQL Server

Setting maximum database file sizes in SQL Server is something you’d ideally not have to set, but it’s a good last resort option available if you need it. The reason I say this is because, you never want a production database to stop updating/inserting data due to a size cap on the database. However, if […]

How to run Update-Help in PowerShell
February 19, 2019
Updating Help Documentation in PowerShell

The Update-Help cmdlet in PowerShell will download the latest help files for PowerShell modules installed on your machine. Running PowerShell as Administrator is a requirement for this one, else you’ll get the following error. “Access is denied” is the key part in this error, amongst a lot of irrelevant info. And when you do run […]

Moving TempDB Files in SQL Server
February 17, 2019
Moving TempDB Files in SQL Server

It’s a solid best practise to have TempDB files stored in separate drive, away from your C: drive. This is because TempDB can grow very large, very quickly (within minutes); depending on workloads of course, and this can happen on both the TempDB data (.ndf) and log (.ldf) files. This post is a quick tutorial […]

January 24, 2019
The Import Flat File Feature

The Import Flat File wizard within SSMS was introduced in December 2017 (14.0.17213.0). This is a streamlined version of the Import Data feature and it minimises the user intervention during a file import. Unlike the Import data feature, you don’t have the option to save the import as a .DTS package. This makes it a […]

January 22, 2019
Attaching SQL Databases Without Log Files

If you’ve lost a database log file and you’re in critical need of the data, well… that would never happen ( ͡° ͜ʖ ͡°) Nevertheless, this is might be a handy random fact to know, that you can attach a data (.mdf) file without the associated log (.ldf) file in SQL Server. This post will […]

January 20, 2019
Backup & Restore (WITH FILE)

In this post I’m going to show what the WITH FILE = X option does when backing-up or restoring a SQL Server database. microsoft_documentation The first thing we need to know is that a backup file can contain multiple databases, and even multiples of the same database. If you run a quick backup command on a […]

January 13, 2019
Applying Data Retention to a SQL Table

There are many reasons why you’d need to delete old data from a table within a database, some of which include; # GDPR (adhering to data retention policies)# Ever increasing tables becoming tougher to manage (e.g. a replication refresh is taking 2 days)# SQL Server Express limitations (10GB max database size)# The table is storing application […]

October 22, 2018
Using Custom Connection Colours in SSMS

SSMS has an option that allows you to change the colour of your query banner, which is useful if you want visually mark a server that you work with every-day. A while back, when I was frequently switching between live & test SQL instances, I set them to red/green. Red obviously meaning be cautious! Nowadays, […]

October 9, 2018
Count rows within CSV files using PowerShell

This post is a quick run-through of using a PowerShell script to count rows within a bunch of CSV files. You might find this useful for verifying row counts, if importing multiple CSV files into a database. Count Rows within CSV Files First, open PowerShell ISE on your machine. Have a quick look at your […]

October 2, 2018
Default Data Export Settings in SSMS

Exporting data out of SQL is an easy task, but there’s always a few snags that’ll crop up here and there, like always. This is just a quick note on the default export file options when using SQL Server Management Studio. Export Query Results to File To export a query the simplest way, it would […]

October 1, 2018
Checking Table Sizes in SQL Server

There are many ways to check the size of a table in SQL Server. The way you'll do it will likely depend on what you're task at hand is. For example, a quick look at the Disk Usage by Top Tables report on a database you've never seen before would instantly show you the heavy […]

September 16, 2018
Backing Up a SQL Server Database

Backing up a database is something I’ve always found easier done within a query window. There’s not much to it; [crayon-5c70936a00d78699704923/] That’s what I’m used to writing. I’ve no need to worry about the copy_only option these days, or check SQL Server Editions to see if I can use compression. Good times that was. Measuring […]