For loop in Sql Server
how to use For loop in SQL Server?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Vishnujeet KumarPosted Nov 6, 2012, 1:26 AM
DECLARE @intTable INT
SET @intTable = 5
WHILE (@intTable <=50)
BEGIN
PRINT @intTable
SET @intTable = @intTable + 5
END
GO
Rajeev KumarPosted Jul 10, 2023, 7:42 AM
There is no concept to use for loop SQL. You have to use only while loop.
Santhosh Kumar JayaramanPosted Nov 6, 2012, 12:45 AM