This script monitors and reports the execution statistics of SQL statements over a specified period, capturing metrics such as execution counts, CPU time, I/O operations, and elapsed time. It provides a comprehensive view of query performance, aiding in the diagnosis of performance issues and identifying problematic SQL queries in the database.
2024-07-29 (first published: 2024-07-11)
1,254 reads
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)
1,734 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)
375 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,351 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)
25,237 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)
5,067 reads
Can be useful when inserting a lot of data into a table.
2019-02-26 (first published: 2019-02-14)
5,046 reads
A TVF to select prime numbers
2018-11-30 (first published: 2017-04-01)
1,061 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)
379 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)
817 reads