SQL Data Type to store build versions

Perhaps have three or four numeric fields to the version table:

Major, Minor, Revision, Build

I would consider storing each part of the number in a separate TINYINT/SMALLINT field.


A good solution would be to use an integer building the value to store like so:

MAJOR * 10000 + MINOR * 100 + Revision

Assuming each one can range from 0..99. If you want to go 0..999 use

MAJOR * 1000000 + MINOR * 1000 + Revision

This will sort properly, will query easily, is compact (1 int column), is easily decomposed and can even be decomposed visually.