• I couldn't agree more. Whenever I carry out code reviews, especially for junior members of the team, I typically find these to be the most common errors they make. I have seen people using VARCHAR for storing everything (dates, money, floats)! Their excuse? Globalization/Internationalization.

    We have a variety of data-types that can satisfy almost every computing and storage need - whenever a system is designed, time should be spent arguing the use of one data type of the other. Once the decision has been made, the code should not assume that the field will contain only one data pattern - unless the code is explicitly taking care of the same (eg. storing all dates in UTC, and then the representation is handled by the UI). Either way, exlicit checks & conversions should always be made.

    Thanks & Regards,
    Nakul Vachhrajani.
    http://nakulvachhrajani.com

    Follow me on
    Twitter: @sqltwins