SQL Server. Stored procedure to get the biweekly periods

Posted by Yada on Stack Overflow See other posts from Stack Overflow or by Yada
Published on 2010-12-31T14:26:05Z Indexed on 2010/12/31 14:54 UTC
Read the original article Hit count: 169

Filed under:
|

I'm currently trying to write a stored procedure that can compute the biweekly periods when a date is passed in as a parameter.

The business logic: the first Monday of the year is first day of the biweekly period.

For example in 2010:

    period  period_start  period_end
    1       2010-01-04    2010-01-17
    2       2010-01-18    2010-01-31
    3       2010-02-01    2010-02-14
....
    26      2010-12-20    2011-01-02

Passing today's date of 2010-12-31 will return 26, 2010-12-20 and 2011-01-02.

I'm not too strong in T-SQL. Any help is appreciated. Thanks

© Stack Overflow or respective owner

Related posts about sql-server-2008

Related posts about date