• Lynn Pettis (2/16/2016)


    Orlando Colamatteo (2/16/2016)


    select datefromparts(year(getdate())-1,1,1) as beginning_of_last_year,

    datefromparts(year(getdate())-1,12,31) as end_of_last_year;

    I don't like using closed ended ranges for date ranges. Prefer close ended on the lower end and open ended on the upper end of the date range. That way if the date/time data type changes you don't have to worry about changing the range criteria.

    It depends on the business requirement, whether it's inclusive or exclusive.

    I was only offering an alternate technique to get a date from its parts.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato