Recently I came across a situation where a view took an excessive amount of time to return results when “SELECT TOP …” was applied to…
Category: T-SQL
Aim: In my last blog post, I recorded a sample query for processing JSON in SQL Server so that I can refer back to it…
Aim: Very occasionally I have to process JSON in SQL Server, usually as part of a data warehouse task. Because I don’t do this often,…
In SQL Server 2016, DROP IF EXISTS was introduced to T-SQL for certain objects. Below are the ones that I use most frequently, alongside the…
The following is a quick & easy way to generate some random data in a temp table. It’s not very complex but it can be…
Aim: To clarify the difference between filtering data in a WHERE clause or within the OUTER JOIN. When using an OUTER JOIN, there will be…
I recently came across an interesting way of using the REPLACE function in SQL Server to replace multiple (different) string patterns. Usually, we use the REPLACE…
This week I found out how to perform matrix multiplication using SQL. I don’t think I’ve touched matrix multiplication since university so first I gave…