Показать сообщение отдельно
Старый 23.05.2014, 13:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
emeadaxsupport: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_ModelElementData_HasModelId_LayerId". The conflict occurred in database "YourDataBaseName_model", table "dbo.Model"
Источник: http://blogs.msdn.com/b/axsupport/ar...odel-quot.aspx
==============

Given scenario:

You receive the following failure when compiling the application:

The INSERT statement conflicted with the FOREIGN KEY constraint "FK_ModelElementData_HasModelId_LayerId". The conflict occurred in database "YourDataBaseName_model", table "dbo.Model"



Cause:

This might be caused by some metadata pieces that have offending combination)



Resolution suggestion:

a. Disable the FK constraint from model database by running following SQL statement:

EXEC sp_msforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all"

b. Do a full application compile

c. Run the following SQL query to check the affected objects :



select top 100 *fromModelElementDatamed

where notexists

( select 1 fromUTILMODELSumwheremed.ModelId=um.IDandmed.LayerId=Layer)

d. Take necessary actions to correct the affected objects

e. Enable the FK constraint again on your Model Database by running following SQL statement:

EXEC sp_msforeachtable "ALTER TABLE ? WITH CHECK CHECK CONSTRAINT all"

f. Do a full XPP compilation and a full CIL generation




Источник: http://blogs.msdn.com/b/axsupport/ar...odel-quot.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.