The DELETE statement conflicted with the REFERENCE constraint
Page是主表,主键是pageid;UserGroupPage表中的PageID字段是Page表里的数据。

https://www.codeproject.com/Questions/677277/I-am-getting-error-while-delete-entry
You are trying to Delete the record from a Table which has a reference in another Table.
Here REFERENCE constraint is "FK_User_History_Tbl_Customer".
Tables are User_History and Tbl_Customer.
UserId column is referenced by Tbl_Customer Table.
When you try to delete a row from User_History Table, it comes to know that the same row has some related row in Tbl_Customer Table.
So, you need to delete from Tbl_Customer Table first and then delete from Table User_History.
If you want to delete a row, then you have to execute the following two queries in sequence.
DELETE FROM Tbl_Customer
WHERE UserId = [[[UserIdToDelete]]]; DELETE FROM User_History
WHERE UserId = [[[UserIdToDelete]]]
尝试筛选了一下数据,居然有记录。本地的开发环境是没有记录的
SELECT *
FROM dbo.tba_ugp_UserGroupPage AS c
WHERE EXISTS ( SELECT a.PageID
FROM dbo.tbx_pag_Page AS a
INNER JOIN dbo.tbx_mod_Module AS b ON a.ModuleID = b.ModuleID
WHERE b.PhysicalModuleID IN ( 16, 19 )
AND a.PageID = c.PageID );
The DELETE statement conflicted with the REFERENCE constraint的更多相关文章
- SQL SERVER 2005删除维护作业报错:The DELETE statement conflicted with the REFERENCE constraint "FK_subplan_job_id"
案例环境: 数据库版本: Microsoft SQL Server 2005 (Microsoft SQL Server 2005 - 9.00.5000.00 (X64) ) 案例介绍: 对一个数据 ...
- Store update, insert, or delete statement affected an unexpected number of rows ({0}).
问题描述 Store update, insert, or delete statement affected an unexpected number of rows ({0}). Entities ...
- system.Data.Entity.Infrastructure.DbUpdateConcurrencyException: Store update, insert, or delete statement affected an unexpected number of rows (0) 问题
页面控件没有做限制.提交后还可以继续点击,造成了在短时间内的多次请求.查看日志两次错误在200ms之内. 错误信息 system.Data.Entity.Infrastructure.DbUpdate ...
- using the library to generate a dynamic SELECT or DELETE statement mysqlbaits xml配置文件 与 sql构造器 对比
https://github.com/mybatis/mybatis-dynamic-sql MyBatis Dynamic SQL What Is This? This library is ...
- Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded.
EF6进行Insert操作的时候提示错误 Store update, insert, or delete statement affected an unexpected number of rows ...
- 跨年夜问题:一句并不复杂的delete竟然在delete statement处cost飙升,在数据量上升的十万级就像进入了死循环,执行后久久没有结果
笔者使用的环境: # 类别 版本 1 操作系统 Win10 2 数据库 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bi ...
- Linux: How to delete a disk or LUN reference from /dev
In AIX, there is rmdev command to remove a disk/LUN from /dev directory i.e to make the disk/LUN una ...
- SQL Sever 博客文章目录(2016-07-06更新)
SQL Server方面的博客文章也陆陆续续的写了不少了,顺便也将这些知识点整理.归纳一下下.方便自己和他人查看. MS SQL 数据类型 三大数据库对比研究系列--数据类型 MS SQL 表和视图 ...
- 删除Management Data Warehouse (MDW) job失败
转:http://lzf328.blog.51cto.com/1196996/1349670 最近在清理一些不用的Job,发现几个跟MDW有关的.虽然Job已经被Disable, 但是没有被删除.尝试 ...
随机推荐
- JPA 解析
看图想想相关的架构 1.查询表达式中的接口层次结构 2.CriteriaQuery 封装了传统查询的子句 3.Metamodel API 中的持久化类型的接口的层次结构 4. Metamodel AP ...
- 【Pyton】【小甲鱼】异常处理:你不可能总是对的
Exception 1.assertionerror举例 >>> my_list=['小甲鱼是帅哥'] >>> assert len(my_list)>0 & ...
- C#基础笔记(第十一天)
1.复习字符串(1)字符串的不可变性(2)字符串的方法:1)Split() 分割 把字符串中不想要的内容分割掉 返回一个字符串类型的数组 可以添加StringSplitOption.RemoveEmp ...
- 智能指针 - 现代C++新特性总结
C++98中的智能指针通过一个模板类auto_ptr来实现,new操作符返回的指针可以交由它来管理,程序员不用再显式的调用delete,这在一定程度上避免了堆内存忘记释放的问题:不过auto_ptr有 ...
- TC命令流量控制测试(针对具体IP地址和IP协议)
这里测试系统为Linux操作系统,通过简单的TC命令来实现对带宽的控制. 1对具体IP地址的流量控制 这里采用iperf来进行带宽的测试,首先在服务器和客户端都安装上iperf软件,通过该软件下的命令 ...
- HDU1180:诡异的楼梯(bfs+优先队列)
http://acm.hdu.edu.cn/showproblem.php?pid=1180 Problem Description Hogwarts正式开学以后,Harry发现在Hogwarts里, ...
- oracle实例内存(SGA和PGA)调整
修改oracle内存占用 >show parameter sga; (查看内存占用情况) NAME TYPE ...
- OCR学习及tesseract的一些测试
最近接触OCR,先收集一些资料,包括成熟软件.SDK.流行算法. 1. 一个对现有OCR软件及SDK的总结,比较全面,包括支持平台.编程语言.支持字体语言.输出格式.相关链接等 http://en.w ...
- PHP 自定义header 参数获取的问题
有的情况下,我们需要把参数放在Headers 里传递.比如说与提供给移动端的api,不能进行缓存的时候. 但是,自定义的header 经常是拿不到的. 如果是apache 的服务器,可以用 apach ...
- 消息 8101,级别 16,状态 1,第 1 行 仅当使用了列列表并且 IDENTITY_INSERT 为 ON 时,才能为表'ResourceInfo'中的标识列指定显式值。
问题分析: 意思是你的主键是自动编号类型的,所以不能向该列插入数据. 解决办法: 执行 语句 :SET IDENTITY_INSERT CUSTOMER_TBL ON 然后在向表中插入数据,如inse ...