Dealing with multiple units of measure

  • I have a database that some areas want to use emglish measurments and some want metric.

    How would you implement this.

    A: Have everything stored in one system

    and have views converting to the other,

    B: Have a field with the unit system beside it. and convert as needed

    C: have both using calculated fields

    D: anyother ideas

  • I don't have enough information to give you a definitive suggestion, but perhaps create a units table and a conversions table and then have columns for both measurement and unit wherever the measurements are stored. I guess that's your choice B.

    This has advantages over your other options:

    • Data can easily be consolidated across areas
    • The information on how the data was entered is available
    • Either or both systems can be supported within any database

    If you need all data within an area to be entered in only one system, then use a default constraint and don't insert or update the Unit columns.

    --Jonathan



    --Jonathan

  • I would definitely stick to storing all data in a single unit.

    You could use views to convert stuff. But then again, I believe that displaying a value in a certain unit is a client thing and should not be handled by the server.

  • Just reread your post. If you are talking about 'areas', you might need to store different units.

    E.g. a table about volumes in gallons and one about lengths in millimeters.

    Any governance laws to obey by? If I'm thinking about banking transactions, this won't hold. It is a regulatory requirement here that the amount is stored in the currency it was entered. So we do have some tables with different 'units' in there ($, €, £, ...).

    Another issue could be accuracy, since any conversion sooner or later will yield a (small) difference.

  • I personaly am leaning towards A. Which is similar to letting the client handle (since I will be writing the client).

    There are no goverment rules in this application.

    Yes there will be different units of measeure volume, length, but i am specificly asking about diffrent systems of measure SI, English. for the same length.

    I figure in the client there will be an option for using one system or the other. That basicly just toggles which views and sp's get used.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply