I needed a way to generate unique sequences of numbers so I followed the following simple approach that works fine:
I used a table that has the next value for each sequence.
I get the value increment it by one, store it and use it in my application code.
Problem: I don't know how can I reset this generator.
As an example assume that a part of the program runs and in a loop and at the beginning of a loop the sequence is 102012 and after the loop it is 1045000.
Let's say that my program finishes and then for some reason I need to reset the sequence back to 102012 so that if the program runs again it can generate the same sequence.
The only thing I could think of is to store in a table dates with the sequence at that point.
But my concern is that I would end up with a big table that would have more information than needed.
I was wondering is there a better approach for this? I assume this problem is not rare.