About 1,730 results
Open links in new tab
  1. WHILE (Transact-SQL) - SQL Server | Microsoft Learn

    Nov 18, 2025 · In the following example, if the average list price of a product is less than $300, the WHILE loop doubles the prices and then selects the maximum price. If the maximum price is less …

  2. SQL WHILE LOOP Examples and Alternatives - SQL Server Tips

    May 28, 2025 · In this article, we will look at examples of a SQL Server WHILE loop in T-SQL and discuss alternatives like a CTE and cursor.

  3. SQL WHILE loop with simple examples

    Oct 25, 2019 · This article mentions the basic usage methods of the SQL WHILE Loop with examples and flowcharts

  4. Iterate through a SQL Server result set in T-SQL without a cursor - SQL ...

    Mar 11, 2025 · This article describes methods that you can use to iterate through a result set by using Transact-SQL in SQL Server. This article describes methods that you can use to simulate a cursor …

  5. Syntax of for-loop in SQL Server - Stack Overflow

    May 20, 2011 · What is the syntax of 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 …

  6. 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.

  7. SQL Server WHILE Loop (with Examples) - Database.Guide

    Jul 29, 2024 · The WHILE loop in SQL Server is a control-flow statement that allows us to repeatedly execute a block of code as long as a specified condition is true. It’s useful for iterative tasks and …

  8. WHILE Loops – SQL Tutorial

    Structured Query Language (SQL) is primarily a set-based language, but there are scenarios where iterative processing becomes necessary. In SQL Server, the WHILE loop provides a way to …

  9. SQL Server: WHILE LOOP - TechOnTheNet

    This SQL Server tutorial explains how to use the WHILE LOOP in SQL Server (Transact-SQL) with syntax and examples. In SQL Server, you use a WHILE LOOP when you are not sure how many …

  10. SQL Loop through Table Rows without Cursor - SQL Server Tips

    May 27, 2025 · But sometimes there is a need to loop through the data one row at a time in your SQL queries. In this SQL tutorial we will look at a comparison of how to do a loop without using cursor. …