Technical Article

While Loop in T-SQL

Often, we encounter situations where we need to loop through a dataset to process or update records iteratively. In such cases, I use WHILE loop like below. The example below demonstrates how a WHILE loop can be used to iterate Sales records. This approach is particularly effective when working with a numerical or date column, […]

3 (2)

You rated this post out of 5. Change rating

2024-10-15

60 reads

Blogs

Denver Dev Day Oct 2024 Slides

By

Here are the slides from my talk today: CI in Azure DevOps If you...

Should I Learn PostgreSQL

By

I got asked this question recently: I constantly see PostgreSQL on Microsoft slides, email,...

A New Word: Hickering

By

hickering – n.  the habit of falling hard for whatever pretty new acquaintance happens...

Read the latest Blogs

Forums

Are We Dinosaurs?

By Grant Fritchey

Comments posted to this topic are about the item Are We Dinosaurs?

how to solve a conversion failure error

By Wren

Sample query reply appreciated Getting the following error: Conversion failed when converting the varchar...

Why does SSMS always pop up this window every time I get into it?

By Rod at work

For the last few weeks every time I get into SSMS 20.2 I am...

Visit the forum

Question of the Day

Code Blocks

What happens with this code:

DECLARE @Iteration INT = 0;

WHILE @Iteration < 10
    SELECT CustomerName,
        CustomerStatus
    FROM dbo.Customer
    WHERE CustomerID > 3;

    SET @Iteration += 1;

See possible answers