I want to make a composite key (well that's the idea but I'm open to other suggestions) on a Documents table. It would consist of two columns, year (2010,...) and an ID, which would be autoincrementing but it should restart itself every year.
So keys like these 2010-1, 2010-2, ..., 2011-1, 2011-2, ... and, preferrably those keys should also be used for displaying, printing and searching.
Though I don't believe autoincrementing will work, because of the reset every year, so I guess I'll have to make increments myself, won't I?
Or should I just make a varchar column and construct each key myself and just put a unique on that column?
So, what are my options?
Please also take in consideration future design issues that I might have with a chosen design whatever would it be and ease of querying.
UPDATE:
I'm really starting to look into letting the application construct the key and provide it when inserting. However, it would require looking into DB for the last issued ID, which could result in problems in high volume usage.