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…!!!!
Samuel Fernandes
22-Oct-2013