CELKO (7/9/2012)
Since that would require storing temporal data as character based data, I have to ask why would you do that?
I am naming a time period because T-SQL does not have an INTERVAL data type. No temporal math is done with it. It is the key to INTERVALs in the Calendar and report periods table.
This convention happens to have some major advantages:
language free
fixed length & short
easy regular expressions in DDL and DML
sorts with ISO-8601 display format
It is fast in a query.
Think about looking for all the Januaries in English versus "report_month LIKE '____-01-00' instead. Anyone got a better way to name a time period?
Maybe but the real key here is that I wouldn't name a time period, Joe. Why not use the number of months since "Date zero"?
--Jeff Moden
Change is inevitable... Change for the better is not.