2012/09/27

Project Server 2010 : FOREIGN KEY constraint Error

Hello again ,

Today we are having a n interesting project Server Issue , I dont have a clear idea on the cause of this Issue but Microsoft calims its a bug that will cause some of your GUID to change when you try to use the save and send feature .... anyway when you try to publish you r project you will end up with this error



General
Reporting message processor failed:
ReportingProjectChangeMessageFailed (24006) - The INSERT statement conflicted with the FOREIGN KEY constraint "FK_MSP_EpmTaskBaseline_ProjectUID_TaskUID". The conflict occurred in database "ProjectServer_Reporting", table "dbo.MSP_EpmTask". The statement has been terminated.



so what this error basically say that there is  foreign key want found when it was trying to insert a task with a foreign key UID from another table , in another words less technical there is some data missing from the database ...


so the bad news is you cant really know what is the cause behind this , the good news is there is a solution

actually to make it better the solution is easy
 backup ..backup..backup 


run the following script against your draft database and against your published database
select PROJ_NAME, MTB.PROJ_UID,TASK_UID,TB_BASE_NUM from MSP_TASK_BASELINES MTB


inner join MSP_PROJECTS MP on MTB.proj_uid=MP.proj_uid

where TASK_UID not in (select TASK_UID from MSP_TASKS)

    if and you should get some raws with this command those tasks are the origin of your Issue to resolve it run the following command againest your draft and puplished databes


DELETE FROM MSP_TASK_BASELINES WHERE TASK_UID not in (SELECT TASK_UID FROM MSP_TASKS)


once you run this make sure that you clean the project cashe from the user machine and republish it again

hope this help
regards










2012/09/05

I have did something bad

Hello All , 

I will start with a big disclaimer  : 
 I have did this only for testing and because i needed this database to get attached this is a development environment , and what i did is totally 100% not supported not recommended .