I am looking for a way to speed up the SQL, because I think I am not doing it efficiently, though it is working but very slow when there are more records.
I am using ASP/VBScript, but this is SQL Update issue.
I have a loop FOR, NEXT,
capturing the submission form and process to capture the SortNum
submitted.
for x = 1 to request.form.count
' -- Some where here, I captured the SortNum that associated with RecID
SortNum = TheCapturedRowNum
TheRecID = TheCapturedRecID
sql_UpdateSortNum = "Update Table1 SET SortNum = '"& SortNum &"' where RecID = '"& TheRecID "'"
conn.execute(sql_UpdateSortNum)
Next
Currently, it is working, but the more record (over 50 records), it will get more slower. I guess it is a bad way to loop through and keep executing the update query. Is there a way to speed up the update, like stored and update one time? please note that SortNum
value is NOT the (x) of FOR loop.
Any advice would be appreciated,
Thank you,