In Project Server 2003:
Can anyone be so kind to tell me where can I find the id of the parent task
of a task in the Project Server DB, please?
Thank you in advance!
Elsa
Hello Elsa,
Gérard Ducouret is correct. You have to look MSP_TASKS table for your
PROJ_ID to findout task details and TASK_OUTLINE_NUM column.
You have to write custom script to find out the Task Parent ID. The
below, I am writing some scenario to give basic idea for you. I hope
the following script will be useful for you to address your needs. You
have to define the cursor to get the dynamic results. Here I hard
coded the values for your understanding.
Scenario: PROJ_ID = 512 ; IN MSP_TASKS table, one of the task which
Task_ID is 88
and TASK_OUTLINE_NUM is 2.2.3
qery:
SELECT TASK_ID, TASK_NAME, TASK_OUTLINE_NUM
FROM MSP_TASKS
WHERE PROJ_ID = 512 AND TASK_ID = 88
By running the above query, I noticed my task outline number is 2.2.3;
so, parent should be the task which is having value 2 in
TASK_OUTLINE_NUM.
Now, run the below script. Please determine PROJ_ID and TASK_ID to run
the following script.
--*************************************
declare @strPeriodLeft as int,
@strNewOutline as varchar(255)
/* IN MSP_TASKS table, one of the task which Task_ID is 88
and TASK_OUTLINE_NUM is 2.2.3 */
SELECT @strNewOutline = TASK_OUTLINE_NUM
FROM dbo.MSP_TASKS
WHERE TASK_IS_SUMMARY = 1
AND PROJ_ID = 512 AND TASK_ID = 88
SELECT 'TASK_OUTLINE_NUM of Task IS ' + @strNewOutline
WHILE CHARINDEX('.', @strNewOutline)<> 0
BEGIN
SET @strPeriodLeft = CHARINDEX ('.' ,@strNewOutline)
SET @strNewOutline = LEFT(@strNewOutline,(Len(@strNewOutline) -
@strPeriodLeft))
CONTINUE
END
SELECT TASK_ID, TASK_NAME
FROM MSP_TASKS
WHERE PROJ_ID = 512 and TASK_OUTLINE_NUM = @strNewOutline
---***************************************************
If you have questions, please email me.
Thanks
Chak