Hi, <BR><BR>I am trying to make a stored procedure for SQL Server 7.0. <BR><BR>I want this SP to look up records and update them as needed. I wrote ASP code to do it, but I want to make it SP in order to speed the process up. However, I have no idea how to use loop in the SP. <BR><BR>I included the code, so can somebody advise me how to convert this to SP? OR, at least can anyone tell me whether it&#039;s possible to convert it to SP at all?<BR><BR>PLEASE HELP ME!!<BR><BR>***** <BR><BR><BR>Dim rs, rc <BR><BR><BR>set rs=conn1.execute("select schoolid, schoolname from one_h") <BR><BR>do while rs.eof=false <BR><BR> Dim schoolid, schoolname, name, oneq, twoq, totalqone, totalqtwo, numstudent <BR><BR> <BR> schoolid = rs("schoolid") <BR> schoolname = rs("schoolname") <BR><BR> numstudent = 0 <BR> totaliqone = 0 <BR> totaliqtwo = 0 <BR><BR> set rc=conn1.execute("select name, oneq, twoq from member where schoolstatus = &#039;" & "ABC" & "&#039; AND schoolid = &#039;" & schoolid & "&#039;") <BR> <BR> do while rc.eof=false <BR> <BR> numstudent = numstudent + 1 <BR> totaliqone = rc("oneq") + totaliqone <BR> totaliqtwo = rc("twoq") + totaliqtwo <BR> <BR> rc.movenext <BR> loop <BR> <BR> rc.close <BR> set rc = nothing <BR><BR> if numstudent &#060;&#062; 0 then <BR> <BR> Dim SQL <BR> <BR> SQL = "Update one_h set numstudent = &#039;" & numstudent & "&#039;, totaliqone = &#039;" & totaliqone & "&#039;, totaliqtwo = &#039;" & totaliqtwo & "&#039; where schoolid = &#039;" & schoolid & "&#039;" <BR> conn1.execute(SQL) <BR><BR> <BR>rs.movenext <BR>loop <BR><BR>rs.close <BR>set rs=nothing <BR>