Hi AllI am finding very strange behaviour inside while ...I have big stored procedure which do the calculation on business requirement . In my sp aim using while loop and its resulting duplicates.. I can't paste that proc here because it doing number of things that i will not be able to explain.. but i created same scenario to explain that issue.declare @min int,@max int,@datarow varchar(2000),@id intcreate table #table ( id int, datarow varchar(2000))set @id= ''set @datarow=''insert into #table(id,datarow)select 1,'hetejajla'union allselect 4,'hetejajla'Select * from #tableSelect @min=MIN(id) ,@max =MAX(id) from #table--- Select @min, @maxwhile (@min<=@max)beginSelect @id=id,@datarow=datarow from #table where id =@minSelect @id as id ,@datarow as datarowset @min=@min+1--select end you can see that in my table #table has only two records with ids 1 and 4.When I run above code which gives me result .id datarow1 hetejajlaid datarow1 hetejajlaid datarow1 hetejajlaid datarow4 hetejajlabecause of this 2 records converted on 4 records ...This loop shold only display two entriesid datarow1 hetejajlaid datarow4 hetejajlaWhy this is showing extra records...Pleas suggest me on this tried every possible stuff but can't get rid of the this behaviour.
Vijay is here to learn something from you guys.