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 User 2551 22-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 !


Message
Can you answer this question?

Answer

1 Answers

Liked By