Queries below are from the 12.06 delete investments job - they may help you identify what project is causing the problem.
/* If any value is returned for the chosen project then it cannot be
marked for deletion
Queries below taken from projectPurgePMD.xml on server (modified to display a reason code)
*/
declare @pid as integer
set @pid = (select ID from srm_projects where unique_name = '80231')
select x.project_id, project_code, reason
from
(
SELECT isnull(1,0) Code, i.id as project_id, i.code as project_code,
convert(varchar, count(i.id)) + ' Time entries present' as reason
FROM PRTimeentry E, PRTimesheet S, PRTask T, PRAssignment A, INV_INVESTMENTS I
WHERE
E.prAssignmentID = A.prID AND A.prTaskID = T.prID AND T.prProjectID = I.ID
AND E.prTimesheetID = S.prID
AND S.prStatus <> 0 AND S.prStatus <> 2 AND E.prActSum IS NOT NULL AND E.prActSum > 0
AND I.ID = @pid
GROUP BY
i.id, i.code
UNION
SELECT 2 Code, investment_id as project_id, project_code,
'In WIP' as reason
FROM PPA_WIP
WHERE investment_id = @pid
UNION
SELECT 3 Code, srm.id as project_id, t.project_code,
'In Trans Control' as reason
FROM PPA_TRANSCONTROL t INNER JOIN SRM_PROJECTS srm on t.project_code = srm.unique_name
WHERE srm.id = @pid
UNION
SELECT 4 Code, srm.id as project_id, project_code,
'Imported transactions' as reason
FROM IMP_TRANSACTIONIMPORT t INNER JOIN SRM_PROJECTS srm on t.project_code = srm.unique_name
WHERE srm.id = @pid
UNION
SELECT 5 Code, id as project_id, code as project_code,
'Still active' as reason
FROM INV_INVESTMENTS i
WHERE IS_ACTIVE = 1
AND I.ID = @pid
UNION
SELECT 6 Code, inv_object_id as project_id, srm.unique_name as project_code,
'Posted transactions' as reason
FROM FIN_POSTED_TXNS t INNER JOIN SRM_PROJECTS srm on t.inv_object_id = srm.id
WHERE INV_OBJECT_ID = @pid
UNION
SELECT 7 Code, object_id as project_id, srm.unique_name as project_code,
'Other transactions' as reason
FROM FIN_TXNS t INNER JOIN SRM_PROJECTS srm on t.object_id = srm.id
WHERE OBJECT_ID = @pid
UNION
SELECT 8 Code, @pid as project_id, (select unique_name from srm_projects where id = @pid) as project_code,
'Partial allocation to other projects' as reason
FROM INV_HIERARCHIES
WHERE
(parent_id = @pid
OR
child_id = @pid) AND
(DEFAULT_ALLOC_PCT <> 0 AND DEFAULT_ALLOC_PCT <> 1)
) as X