When to use negative identity

The identity value in relational databases is a field that increases automatically. It is often used to create surrogate primary keys. Surrogate keys Surrogate keys are meaningless and are only used to uniquely identify the row, not the data itself. For example, assume the following table: As we can see,

How I use dbatools to automate SQL Server installs

I lot of you have asked me to expand on the automated SQL Server installation I mentioned in my previous article: dbatools is a free PowerShell module with over 500 SQL Server best practice, administration, development and migration commands included https://dbatools.io/ The dbatools team have spent long hours making sure

Use CONTEXT_INFO to avoid firing triggers

DML Triggers are commonly used to apply some business rules to the data in the table. The most common implementation would be updating the date_updated column automatically whenever the data in the table changes. For the illustration, this can be done with a following trigger: However, there are times where

Why I use VMware Workstation instead of Hyper-V on my laptop

Being able to run virtual machines on our local computers, whether for testing or development is very convenient and almost natural. Hyper-V is part of Windows and is an obvious choice for many. The main advantage is that it’s free. And that’s about it. This post is based on recent

Rapid SQL Server test instances with Docker and Azure

As a DBA, developer, and more importantly the creator of SQLWATCH.IO, I need the ability to rapidly deploy and test different SQL Server configurations or test different upgrade variations from one version of SQLWATCH to another. This is quite laborious, time-consuming tasks as I either have to build a new SQL

How to intelligently auto-cycle ERRORLOG using T-SQL

In my previous post, I described different ways to read very large SQL Server Log (ERRORLOG) – 5GB to be exact. However, this was a reaction to something that has already happened. In this post, I will show you how to prevent this from happening at all.

Add colours to the ERRORLOG

When dealing with large logs I often find it difficult to find the information we are looking for. To make it easier, we can use PowerShell to add colours the ERRORLOG based on string patterns Note this will only work when using the Select-String command. Remote ISE Even though we need physical