forum

Home / DeveloperSection / Forums / How can I use select in a SQL Server while loop?

How can I use select in a SQL Server while loop?

Anonymous User231722-Oct-2013

How can I use select in a SQL Server while loop? Below have my demo code: -

 declare @loopVal integer 
 set @loopVal =1
 while (@loopVal <10)
 begin
   select @loopVal as m;
   set @loopVal =@loopVal +1
 END 


I want it to return all select results in one table but it will returns 10 separate table ... how can I achieve my task?

Please help me out…!!!!



Updated on 22-Oct-2013
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By