Results 1 to 3 of 3

Thread: Date vs. Number

  1. #1
    Join Date
    Jan 2005

    Unhappy Unanswered: Date vs. Number

    I'm setting up a db with a "Location" table that has fields "Country, State, City, County, From and To"
    I'd like From and To to be simply years, e.g. 1886, 1952, whatever, but I want to be able to eventually pull out selected records such as give me the names of the people (in another related table) who worked in this County between this year and that year.
    Would it be best to try to set up From and To as dates or as numbers? I've been trying all sorts of variations of input masks / formats with the Date/Time data type to get just the 4-digit year with no success.
    Thanks for any thoughts.

  2. #2
    Join Date
    Apr 2002
    Toronto, Canada
    use a number | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    No doubts about it......
    If the true field is numeric then use a numeric value
    If you are representing a calendar year then use the year, especially if yiou expect users to serach on OR BETWEEN values

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts