Introduction

In this article, I will explain how to get the Task Hierarchy for a specific project in Project Server via T-SQL.

Scenario

In Project Server, I have a project schedule with the summary task and subtasks, as shown below.

Task Structure

Based on the requirement, I would like to show the Task Hierarchy for each task in the Tasks View "[MSP_EpmTask_UserView]" for a specific project.

Task Structure output

Steps

To get the Task Hierarchy, we will use the Recursive Queries Using Common Table Expressions, as shown below.

ProjectWebApp

Get the tasks based on the ProjectUID

Applies To

In Project Server 2016, a single database (SharePoint Content Database) holds the project data and the content.

Conclusion

In this article, I have explained how to show the Task Hierarchy for a specific project in Project Server Database using T-SQL.