本文介绍了为什么我的查询会出错?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

delete from Tbl_Sales where C_INVOICE='AP-SIV-VS-111' and c_year=2015





收到此错误





am getting error for this

Msg 547, Level 16, State 0, Procedure Trig_Sales_delete, Line 31
The DELETE statement conflicted with the REFERENCE constraint "FK_Tbl_Sales_Details_Tbl_Sales". The conflict occurred in database "Pulse_VIVO", table "dbo.Tbl_Sales_Details".
The statement has been terminated.





请告诉问题在哪里?



please tell where is the issue?

推荐答案

delete sd.* from Pulse_VIVO..Tbl_Sales_Details sd
inner join Tbl_Sales s on ds.sales_id = s.id
 where s.C_INVOICE='AP-SIV-VS-111' and s.c_year=2015


delete from Tbl_Sales where C_INVOICE='AP-SIV-VS-111' and c_year=2015





但要注意:这可能不是行的结束。例如,在Tbl_bill中可能存在到Tbl_Sales和Tbl_Sales_Details的链接。这一切都取决于你的数据结构。



祝你好运^ _ ^

Andy



but beware: this might not be the end of the line. There could be a link to Tbl_Sales and Tbl_Sales_Details in Tbl_bill for example. It all depends on your data structure.

Good luck ^_^
Andy




这篇关于为什么我的查询会出错?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 18:18