Tuesday, February 14, 2012

Char(4) or integer for Year / Quarter Field

Hello,
what's best for year resp. quarter Field, char(4) resp. char(1), integer or other?
Both are part of a composite index.
Thanks
Silaswhat does "resp." mean?

best for a numeric year like 1937, 2007, etc. is SMALLINT

best for quarter (1-4) is TINYINT|||Why not combine them both?

SMALLINT as 20074 (yyyyq)
this will work upto year 3276 and quarter 4.|||why not? because how would you pull out the rows for 2007 that way?

that's why not combine them :)|||why not? because how would you pull out the rows for 2007 that way?

that's why not combine them :)
That's why :-)

resp. = respectively , isn't it?|||I thought this could pull all records for 2007

Col1 >= 20071 And Col1 < 20081

but then again, I might be wrong.|||yes, that works, but it's clumsy

now show me how to get all the rows for the 3rd quarter only

clumsier and clumsier!!

;)

No comments:

Post a Comment