About 9,650,000 results
Open links in new tab
  1. Syntax of for-loop in SQL Server - Stack Overflow

    May 20, 2011 · 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. …

  2. SQL FOR Loop Alternatives - SQL Server Tips

    Dec 13, 2021 · Learn different ways to create FOR Loops using T-SQL such as using WHILE loops, cursors, tally tables and more.

  3. WHILE (Transact-SQL) - SQL Server | Microsoft Learn

    Nov 18, 2025 · Sets a condition for the repeated execution of a SQL statement or statement block. The statements are executed repeatedly as long as the specified condition is true.

  4. SQL Server: FOR LOOP - TechOnTheNet

    Learn how to simulate the FOR LOOP in SQL Server (Transact-SQL) with syntax and examples. In SQL Server, there is no FOR LOOP. However, you simulate the FOR LOOP using the WHILE LOOP.

  5. Loops in SQL Server - TutorialsTeacher.com

    In SQL Server, a loop is the technique where a set of SQL statements are executed repeatedly until a condition is met.

  6. For Loop in SQL Server Stored Procedure

    Mar 7, 2024 · First, I want to say that SQL Server doesn’t have ‘FOR LOOP’, but you can achieve similar iterative processing using the ‘WHILE’ loop. So, instead of ‘FOR LOOP’, you will use the ‘WHILE’ …

  7. Understanding Loops in SQL Server

    Loops are an essential part of programming as they allow you to execute a block of code repeatedly. In SQL Server, there are several types of loops that you can use to achieve this. In this article, we will …

  8. Syntax of for-loop in SQL Server - JanBask Training

    Apr 17, 2025 · In SQL Server, the FOR loop is used for iterating over a range of numbers or through a result set. However, it is not a native feature in SQL Server like in traditional programming languages …

  9. How do I loop through a set of records in SQL Server?

    Often code can be re-written in a set based manner (i.e. avoid loops). If you're adamant you want to perform an RBAR operation (simple-talk.com/sql/t-sql-programming/…) then a cursor is the thing you …

  10. FOR Loop in SQL Server - Developer Publish

    Nov 20, 2024 · In the above example, the simulated For Loop in SQL Server would terminate after executing 15 times. In this post, you'll learn how to use FOR Loop in SQL Server with some good …