locked
Get the upcoming task for week ahead RRS feed

  • Question

  • Hello guys, Please I need to construct a sql query to get the activities/task schedule for the 7 days from the current date. Thanks
    Thursday, November 3, 2011 1:08 PM

Answers

  • This code will likely need to be adjusted a bit to get it exactly right but it is a good place to start. It will return the tasks that whose start date are greater than the current system time on the sql server but less than the current system time + 7 days.

     

    SELECT     MSP_EpmProject_UserView.ProjectName, MSP_EpmTask_UserView.TaskName, MSP_EpmTask_UserView.TaskStartDate, 
                          MSP_EpmTask_UserView.TaskFinishDate
    FROM         MSP_EpmProject_UserView INNER JOIN
                          MSP_EpmTask_UserView ON MSP_EpmProject_UserView.ProjectUID = MSP_EpmTask_UserView.ProjectUID
    WHERE     (MSP_EpmTask_UserView.TaskStartDate > sysdatetime()) AND (MSP_EpmTask_UserView.TaskStartDate < DATEADD(dd, 7, sysdatetime()))
    


    Brian Kennemer – DeltaBahn Senior Architect
    endlessly obsessing about Project Server…so that you don’t have to.
    Blog | Twitter | LinkedIn
    • Marked as answer by ghostme Tuesday, November 22, 2011 9:23 AM
    Wednesday, November 16, 2011 4:30 PM

All replies

  • Check the datetime function available in T_SQL: http://msdn.microsoft.com/en-us/library/ms186724.aspx
    Blog | Facebook | Twitter | Posting is provided "AS IS" with no warranties, and confers no rights.
    Project Server TechCenter | Project Developer Center | Project Server Help | Project Product Page
    Wednesday, November 16, 2011 4:17 AM
  • This code will likely need to be adjusted a bit to get it exactly right but it is a good place to start. It will return the tasks that whose start date are greater than the current system time on the sql server but less than the current system time + 7 days.

     

    SELECT     MSP_EpmProject_UserView.ProjectName, MSP_EpmTask_UserView.TaskName, MSP_EpmTask_UserView.TaskStartDate, 
                          MSP_EpmTask_UserView.TaskFinishDate
    FROM         MSP_EpmProject_UserView INNER JOIN
                          MSP_EpmTask_UserView ON MSP_EpmProject_UserView.ProjectUID = MSP_EpmTask_UserView.ProjectUID
    WHERE     (MSP_EpmTask_UserView.TaskStartDate > sysdatetime()) AND (MSP_EpmTask_UserView.TaskStartDate < DATEADD(dd, 7, sysdatetime()))
    


    Brian Kennemer – DeltaBahn Senior Architect
    endlessly obsessing about Project Server…so that you don’t have to.
    Blog | Twitter | LinkedIn
    • Marked as answer by ghostme Tuesday, November 22, 2011 9:23 AM
    Wednesday, November 16, 2011 4:30 PM