Requesting help with naming TSQL functions.
Existing function names (see below for table and relationship descriptions)
I currently have functions named as follows:
- CustomerYearsGetByYearRangeOffset: For each CustomerID, return all of their CustomerYears records, over a specified begin/end range
- CustomerYearsGetLatestByYearRangeOffset: For each CustomerID, return their latest CustomerYears record, over a specified begin/end range
- ObjectRevisionIDsGetByYearRangeOffset: For each ObjectID, return all of their ObjectRevisionIDs records, over a specified begin/end year range
- ObjectRevisionIDsGetLatestByYearRangeOffset: For each ObjectID, return their latest ObjectRevisionIDs record, over a specified begin/end year range
Note: All accept a caller-specified begin/end year range offset (relative to the current year). For example, begin/end year offsets -1, 0 would indicate the year one-year prior and the current year.
Two new functions
The two new functions will implement more sophisticated logic, as follows:
For each CustomerID, return their latest ObjectRevisionIDs records tied to their latest CustomerYears record, over a specified begin/end year range
For each CustomerID, return all their ObjectRevisionIDs records tied to their latest CustomerYears record, over a specified begin/end year range
What to name the new functions?
Some drafts:
- ObjectRevisionIDsInLatestYearGetLatestByYearRangeOffset
- ObjectRevisionIDsInLatestYearGetByYearRangeOffset
Other ideas?
Am I thinking about this wrong? For example, abandon the explicit naming approach above and name according to the higher level need it meets?
I see myself calling these new functions frequently, so I prefer to get something that seems "right" each time I use it. ;o)
Thanks for any assistance. Usually when I get this far in writing a question the answer presents itself, but not this time.
Background: tables and relationships
To keep things simple for this question, the database contains four tables (in reality many more tables and fields):
- Customers (CustomerID)
- CustomerYears (CustomerID, Year)
- Objects (ObjectID, CustomerID)
- ObjectRevisions (ObjectRevisionID, ObjectID, CustomerID, RevisionNumber, Year)
In a nutshell: each year the Customer participates, they get a new record in CustomerYears. In each year, they will have one or more Objects, each of which can have one or more revisions.
For example:
Customers (CustomerID)
1
2
CustomerYears (CustomerID, Year)
1|2011
1|2012
2|2012
Objects (ObjectID, CustomerID)
A|1
B|1
C|2
ObjectRevisions (ObjectRevisionID, ObjectID, CustomerID, RevisionNumber, Year)
1|A|1|1|2011
2|A|1|2|2011
3|B|1|1|2011
4|A|1|1|2012
5|B|1|1|2012
6|B|1|2|2012
7|C|2|1|2012
8|C|2|2|2012