SQL Server Performance

Getting Weeks Start Dates for a Given Month.

Discussion in 'ALL SQL SERVER QUESTIONS' started by Arman, Jul 10, 2012.

  1. Arman New Member

    Hello, I need some help from the experts to get the Start date for each week in a given month.

    For example:

    Month = June

    Week Started:
    06-01-2012 (Week1)
    06-08-2012 (Week2)
    06-015-2012 (Week3)
    06-022-2012 (Week4)

    Basically i need to create an SSRS report and needs to setup parameters like Month and Weeks.I research alot but didnt find any good resolution.[IMG]

    Thanks! Ad
  2. Madhivanan Moderator

    Untested

    declare @month varchar(20)
    set @month='June'
    select dateadd(week,number,cast(@month+' '+datename(year,getdate()) as datetime)) from master..spt_values
    where type='p' and number between 0 and 3
  3. Arman New Member

    Thanks a lot of the reply Madhivanan !

Share This Page