I am just wondering or try to understand how this wile loop is working...
here is my while loop
While (@Var >0)
Begin Transaction Trans
Insert into #Temp1 (Id,sname,fname)
select top (500)
Delete table1 from table1 join table1.id = #Temp1.id Truncate Table #Temp1 Commit Transaction Trans
My question to you guys or Please explain me, How the While Loop know everytime top (500) would be different? or it is not grabing same toop (500) rows everytime?