----------This is loop example in sql server---------------- Declare @maxNo int Declare @i int set @maxNo=4 set @i=1 print 'Output' ---Use while loop---- while(@i<=@maxNo) begin print @i set @i=@i+1 end --output------ 1 2 3 4
Join MindStick Community
You need to log in or register to vote on answers or questions.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
Declare @maxNo int
Declare @i int
set @maxNo=4
set @i=1
print 'Output'
---Use while loop----
while(@i<=@maxNo)
begin
print @i
set @i=@i+1
end
--output------
1
2
3
4