I have a TO DO Table with a Position Column. (other columns removed for simplicity)
Description varchar(max)
Position int
JobFinished bit
If I have n amount of rows, each time a row is added the position is incremented. So values may look like this:
Drop Off Kids, 0, 0
Get Groceries, 1, 0
Pickup Kids, 2, 0
Now, If I do something I want to remove it from the table. And increment all other position columns so they are in order from 0.
Ie If I Get Groceries I need the values to look like this:
Drop off Kids, 0, 0
Get Grocerieis, NULL, 1
Pickup Kids, 1, 0
Is there any way with SQL I could do this? (Im using SQL server)