I'm in the process of designing the Calendar table. I took some inspiration from Database design book by Louis Davidson.
What I'm confused about are the data types.
Example:
MonthName varchar(10) NOT NULL,
Year varchar(60) NOT NULL,
Day tinyint NOT NULL,
DayOfTheYear smallint NOT NULL,
Month smallint NOT NULL,
Quarter tinyint NOT NULL,
I think the Year
might be a typo, but not sure why it's VARCHAR
when other numeric dateparts are of numeric data types.
But why is Month
SMALLINT
when it could be TINYINT
as well?
I thought I should design table to use the smallest correct data type to save some page space (even insignificant).
On the other hand the DATEPART
function in TSQL returns INT
data type, so maybe I should make all the numeric columns INT
to avoid conversion cost?