Syntax of for-loop in SQL Server - Stack Overflow
What is the syntax for a for loop in TSQL? ... SQL is a very different language compared to what you're used to. It's focused on what, not how. You tell SQL Server what results you want, and let it figure out how to produce the answer....