I have an application that needs to generate an unique identifier per item, this identifier is a mix of some initials, the date and 4 digits that increment for each new item. The tricky part is that the last 4 digits should reset monthly.
As an example, lets say we have UID “SP-20121218-0001”, the last 4 digits “0001” will increment up until January, and then the first item created in January should have “SP-20130101-0001”.
Any thoughts?
create a table with fields Year, Month, CurrentCount. write a stored procedure that selects a row for the current year and month, if it does not exists creates it and increments the number.