FYI: You can get the Notebook for this article on my github and experiment yourself (opens with Azure Data Studio). Preamble Everybody knows that using loops in SQL Server is not efficient, if you’re able to write that same logic in a set-based statement it’s guaranteed to be faster.Still, devs can’t be helped, you just can’t seem to nail down the set-equivalent statement...
Get faster performance and lower network usage in SQL Server Loops by avoiding the “DONE Token” overload
G