While loop in SQL Server 2008

InfoPath alternatives for form designing SharePoint

In this post we will discuss about how to use while loop in SQL server 2008. Also you can check out my previous posts on Difference between primary key and unique key in SQL Server, Difference between primary key and foreign key in SQL server and Like operator examples in SQL Server 2008.

Below is the syntax to use While Loop in SQL Server:


SET @flag = 0

WHILE @flag <= 5


SET @flag = @flag + 1

PRINT ‘You are in ‘ + CAST (@flag AS NVARCHAR(10)) +’ Loop’


The out put will come as shown in the figure below.

Similar SharePoint 2013 Tutorials

About Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SharePointSky.com

View all posts by Bijay Kumar →

Leave a Reply