In the world of SQL Server, adaptation is key. While the built-in GENERATE_SERIES() function was a valuable addition in SQL Server 2022, its absence in older versions created a functionality gap. Enter the user-written GENERATE_SERIES function. Adapted from Jeff Moden's "dbo.fnTally", it offers an efficient means to generate a series of numbers within a defined range in older SQL Server versions. Its design mirrors the built-in function in SQL Server 2022, making the transition between versions as simple as removing the dbo. prefix. This forward-thinking design reflects the ingenuity of the SQL Server community, ensuring a seamless, efficient database migration experience.
2023-06-26 (first published: 2023-06-16)
975 reads
An alternative for Microsoft's STRING_SPLIT function that will work on SQL Server 2012 and higher.
2022-12-19 (first published: 2021-03-05)
327 reads
An alternative for Microsoft's STRING_SPLIT function that will work on SQL Server 2012 and higher.
2021-03-11 (first published: 2021-03-05)
2,046 reads
An alternative for Microsoft's STRING_SPLIT function that will work on SQL Server 2012 and higher.
2019-12-05 (first published: 2019-02-28)
24,131 reads
The function is an inline table-valued function (or sometimes called a parameterised view) so it can be used just like a view or a table but needs parameters. It generates a single-column table of datetime2 with rows differing by any multiple of any of the dateparts that SQL Server provides.
2019-08-29 (first published: 2019-08-20)
4,786 reads
Can be useful when inserting a lot of data into a table.
2019-02-26 (first published: 2019-02-14)
4,744 reads
A TVF to select prime numbers
2018-11-30 (first published: 2017-04-01)
1,044 reads
This table valued function will quickly find the prime factors of any number up to 10 trillion
2017-04-26 (first published: 2017-04-06)
367 reads
This stored procedure will truncate a table even when other tables have FKs referencing columns in it. It drops the Fks, truncates the table, re-creates the FKs
2017-04-19 (first published: 2017-03-28)
760 reads
A fast table valued function to generate a list of prime numbers within the range specified by the parameters.
2017-04-12 (first published: 2017-03-30)
393 reads