Fundamentals: White space and Line Breaks

Something that is important in any language is formatting. I don’t just mean in computer languages, such as Python (where good use of tabbing is required as part of the syntax), I mean in any written language. From T-SQL to English, Rust to Japanese and Braille to Russian, what ever language you’re writing it’s important to make sure it’s well presented. Even this post you’re reading now, I’ve tried to ensure has good formatting, and is why I use a code prettifier/beautifier. So, why is formatting so important? One of the biggest reasons is that it makes your code readable….

Continue reading

3 years later and STRING_SPLIT is still incomplete

Bit of a mini rant today I’m afraid. Many of us are aware that STRING_SPLIT was added in SQL Server 2016, and yet 3 years later it’s still incomplete. Why it’s incomplete There’s two major problems, in my view, with STRING_SPLIT. The first is that it doesn’t provide an ordinal position for the text extracted. For a string like ‘B,D,C,A’ this means you could just as easily get the rows A, B, C and D as you could B, D, C and A. When working with delimited data, knowing the ordinal position is often really important, and often a must….

Continue reading

Speed Test: rCTE vs Tally

Something that many of us see is the use of a recursive Common Table Expression (rCTE) to perform “iterative” tasks, something that actually can very likely be performed far quicker with a dataset approach by using a Tally Table. Not as many of us are familiar with a Tally as the rCTE, however, I’ll give a brief explanation of both, and then provide some speed tests to show by just how much a Tally can out perform an rCTE. TL;DR: Conclusion. All these tests were performed on my Home Workstation. The recursive Common Table Expression (rCTE) The name effectively gives…

Continue reading