1

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?

1

From my view so far, Year field needs being as text one in some cases e.g. to support Chinese Year Name - this year 2019 is called 'Ji Hai'

But anyway, we should always have Year field as INT.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.