Click here to Skip to main content
15,891,864 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
update Tbl_Sales_Details set c_year=2015 where c_prefix='wb-siv-vv-' and N_SRNO=5

iam getting error for above mentioned query..
please help me out..

Msg 547, Level 16, State 0, Line 1
The UPDATE statement conflicted with the FOREIGN KEY constraint "FK_Tbl_Sales_Details_Tbl_Sales". The conflict occurred in database "Pulse_VIVO", table "dbo.Tbl_Sales".
The statement has been terminated.
Posted

could drop the foreign key, make sure its not needed first though. I'm guessing that really that's just duplicated data and should only really be in one of those tables.
 
Share this answer
 
Check the constraint FK_Tbl_Sales_Details_Tbl_Sales. Make sure the value that you are trying to insert is available on the column referenced in the referenced table.
 
Share this answer
 
v2
The c_year column in Tbl_Sales_Details table is foreign key to the Tbl_Sales table. You were trying to insert the value of 2015 which does not exist in Tbl_Sales table. This value must exist in the Tbl_Sales table first.
Reference: SQL FOREIGN KEY Constraint[^]
 
Share this answer
 
Comments
Member 11337367 18-Jun-15 1:00am    
I first executed in tbl_sales but same error throwing..there is no solution for this issue..

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