Click here to Skip to main content
15,910,603 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_MamJointAccountHolder_MamAccountOpening". The conflict occurred in database "NexGenCoSysDBDev", table "dbo.UsmOffice", column 'UsmOfficeId'.
The statement has been terminated.
Posted
Comments
Alexander Dymshyts 8-Oct-13 3:53am    
where is the question?

You have a constraint on your data base named FK_MamJointAccountHolder_MamAccountOpening
Find which table has this constraint by this script :

SQL
SELECT OBJECT_NAME(OBJECT_ID) AS NameofConstraint,
SCHEMA_NAME(schema_id) AS SchemaName,
OBJECT_NAME(parent_object_id) AS TableName,
type_desc AS ConstraintType
FROM sys.objects
WHERE type_desc LIKE '%CONSTRAINT'
AND OBJECT_NAME(OBJECT_ID)  LIKE N'%FK_MamJointAccountHolder_MamAccountOpening%'


and then check the constraint.
 
Share this answer
 
there was problem on foreign key.
So i have gone to design view and relationship and then clicked to relationship.
and to tables and column specification so i found on foreign key column MemMemberRegistration.

The foreign key should be:

SQL
ALTER TABLE [dbo].[MamAccountOpening]  WITH CHECK ADD  CONSTRAINT [FK_MamAccountOpening_UsmOffice] FOREIGN KEY([UsmOfficeId])
REFERENCES [dbo].[UsmOffice] ([UsmOfficeId])
GO
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900