What’s New in SQL Server 2022: GENERATE_SERIES()


I’ve been doing a lot of work with SQL Server 2022 lately and one of my absolute favorite new features that I just came across today is the GENERATE_SERIES() built-in table function. I just happened to see it in the Books Online content while looking up the syntax for something else.

GENERATE_SERIES (Transact-SQL) – SQL Server | Microsoft Learn

SELECT * FROM GENERATE_SERIES(0,100)

So simple, yet so utilitarian. There are countless scenarios where a sequential table of numbers is useful in code. It can easily solve a lot of situations you would typically use a RBAR