My SQL table has 2 fields that impact my problem: "Priority" as real, and Start_Date as datetime. As the user adds items to the table, (s)he specifies the Priority for a given Start_Date.
If Item1 is Priority 1, then Item2 may be Priority 2 and it will be given a Start_Date after Item 1.
But if Item2 is given Priority 0.5 (or any number less than the Priority of Item1), then its Start_Date will be before Item 1's Start_Date.
After each Item is added, I want to go through the list of Items and Update all of the Priorities so they are integers, starting with the earliest Start_Date with a Priority =1, then 2, 3, etc.
I am working with SQL 2005. I know I can do this with a cursor. Is there a better way? How so?
Thank you.