Advanced T-SQL: Replacing Slow Cursors with Window Functions
This article looks at replacing a cursor with a window function to improve performance.
2026-08-03
6,517 reads
This article looks at replacing a cursor with a window function to improve performance.
2026-08-03
6,517 reads
Introduction When developers first learn SQL aggregation, they usually start with the GROUP BY clause. It works well for summary reports because it combines multiple rows into a single result for each group. For example, you can calculate total sales per region or average salary per department. The limitation of GROUP BY appears when you […]
2026-06-05
4,369 reads
SQL Server 2022 brought powerful new T-SQL functions that eliminate long-standing workarounds. This article walks through five of the most impactful additions — GENERATE_SERIES, GREATEST/LEAST, DATE_BUCKET, the WINDOW clause, and IS NOT DISTINCT FROM — with practical code examples you can use immediately.
2026-05-29
7,017 reads
2026-05-22
548 reads
I’ve used SQL window functions for years, but I’ve never fully understood framing. To truly master window functions, you need at least a basic grasp of framing and how to apply it to your queries. Framing is especially helpful when working with aggregate functions. How can you overcome this hesitation to try framing?
2025-12-26
A look at window functions in SQL and how they can be used to query data without the restrictions of a GROUP BY.
2025-09-12
7,295 reads
2025-02-26
474 reads
2025-02-12
568 reads
2024-10-30
491 reads
2024-10-23
447 reads
I’m excited to announce the release of a new open-source project that fully automates...
One of my favourite features of SQL Server 2022 was the T-SQL Snapshot Backups....
By Steve Jones
I have said and written this many times: Redgate Software is the type of...
Comments posted to this topic are about the item AI Experience Gap that we...
Comments posted to this topic are about the item Squared Values
Comments posted to this topic are about the item I Don't Want To Do...
What happens when I run this code in SQL Server 2022?
SELECT SQUARE('12') See possible answers