Home Forums SQL Server 2005 T-SQL (SS2K5) How to get week of a mont with input parameter date. RE: How to get week of a mont with input parameter date.

  • In 2005 there are TVF (Table Valued Functions)

    There are not Table Value Constructors.

    Is that what you meant?

    It can be fixed by

    declare @TestDate date = '2012-09-12';

    with SevenRows(n) as (

    select row_number() over (order by (select null)) - 1

    from (SELECT TOP 7 NULL FROM sys.columns)dt(n)

    )

    select dateadd(dd, n,dateadd(wk,datediff(wk,0,dateadd(dd,-1,@TestDate)),0))

    from SevenRows;

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2