Getting Values from start and end dates

  • Unfortunately, the int type isn't really designed to be used as a date field. When you do, you end up having problems with this. Personally, I would add a column as a proper date field. Otherwise a computed column would work, and pass proper dates. For example:
    ALTER TABLE [YouTable] ADD FDATE AS DATEADD(MONTH,FMONTH - 1, DATEADD(YEAR, FYear - 2000, '20000101'));

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

  • When working with date ranges, it's best if everything is expressed as dates.  If you are going to use integers or strings to represent (partial) dates, they should be in YYYYMMDD format, because that is the only format where the order matches a true date order.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

Viewing 2 posts - 1 through 3 (of 3 total)

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