Estou num cliente que após a migração do Project Server 2007 para o Project Server 2010 estava ocorrendo um erro ao tentar criar uma análise de Portfólio. No ULS log do SharePoint trazia a seguinte mensagem:

Exception occurred in method Microsoft.Office.Project.Server.BusinessLayer.LookupTable.ReadLookupTablesMultiLang System.Data.ConstraintException: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints. at System.Data.DataSet.EnableConstraints() at System.Data.DataSet.set_EnforceConstraints(Boolean value) at Microsoft.Office.Project.Server.DataAccessLayer.DAL.SubDal.FillTypedDataSet(Boolean allowCache, DataSet typedDataSet, String[] tables, SqlCommand sqlCommand, Boolean enforceConstraints) at Microsoft.Office.Project.Server.DataAccessLayer.LookupTableDal.ReadLookupTables() at Microsoft.Office.Project.Server.BusinessLayer.LookupTable.ReadLookupTablesMultiLang(String xmlFilter, Boolean autoCheckOut)

Depois de muito buscar encontrei que poderia ser um problema com as Lookup Tables de idiomas na base de dados de ProjectServer_Published.

Para procurar o erro faça as seguintes consultas:

SELECT * FROM dbo.MSP_LOOKUP_TABLE_LANGUAGES WHERE LT_UID NOT IN (SELECT LT_UID FROM dbo.MSP_LOOKUP_TABLES)

SELECT * FROM dbo.MSP_LOOKUP_TABLE_MASK_VALUES WHERE LT_UID NOT IN (SELECT LT_UID FROM dbo.MSP_LOOKUP_TABLES)

SELECT * FROM dbo.MSP_LOOKUP_TABLE_MASK_STRUCTURES WHERE LT_UID NOT IN (SELECT LT_UID FROM dbo.MSP_LOOKUP_TABLES)

SELECT * FROM dbo.MSP_LOOKUP_TABLE_VALUES WHERE LT_UID NOT IN (SELECT LT_UID FROM dbo.MSP_LOOKUP_TABLES)

SELECT * FROM dbo.MSP_LOOKUP_TABLE_STRUCTURES WHERE LT_UID NOT IN (SELECT LT_UID FROM dbo.MSP_LOOKUP_TABLES)

No meu caso era na tabela MSP_LOOKUP_TABLE_LANGUAGES. Para corrigir, executa os comandos abaixos:

DELETE FROM dbo.MSP_LOOKUP_TABLE_LANGUAGES WHERE LT_UID NOT IN (SELECT LT_UID FROM dbo.MSP_LOOKUP_TABLES)

DELETE FROM dbo.MSP_LOOKUP_TABLE_MASK_VALUES WHERE LT_UID NOT IN (SELECT LT_UID FROM dbo.MSP_LOOKUP_TABLES)

DELETE FROM dbo.MSP_LOOKUP_TABLE_MASK_STRUCTURES WHERE LT_UID NOT IN (SELECT LT_UID FROM dbo.MSP_LOOKUP_TABLES)

DELETE FROM dbo.MSP_LOOKUP_TABLE_VALUES WHERE LT_UID NOT IN (SELECT LT_UID FROM dbo.MSP_LOOKUP_TABLES)

DELETE FROM dbo.MSP_LOOKUP_TABLE_STRUCTURES WHERE LT_UID NOT IN (SELECT LT_UID FROM dbo.MSP_LOOKUP_TABLES)

Espero ter ajudado!

Abraços,

André Xavier