Task's parent

E

Elsa L.

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
 
G

Gérard Ducouret

Elsa,

In the MSP_TASKS table of the Draft or the Published database you will find
the TASK_PARENT_UID field.
Hope this helps,

Gérard Ducouret
 
G

Gérard Ducouret

In 2003 version, I'm afraid you will have to play with the TASK_OUTLINE_NUM
field...
Hope this helps,

Gérard Ducouret
 
C

Chak

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
 
E

Elsa L.

Thank you very much for your reply Chak! You have been very kind to provide
me with the example and all! I will adapt your code to my case.
 
E

Elsa L.

Thanks Decouret for your reply, I will have a play with that OUTLINE field,
Chak provided me with an example of a way to use it to retrieve what I need.
Anyway it's good to know that in project server 2007 we have a better way to
do it ;-)
 
Top