Home > Database > Mysql Tutorial > body text

The INSERT statement conflicted with the FOREIGN KEY constr

WBOY
Release: 2016-06-07 17:44:05
Original
2001 people have browsed it

出现这个错误,是因为插入一个长度为0的值至有外键约束的字段内。 我们来做个实验,并尝试解决它。 首先创建两个表,[dbo].[T1]是主表,[dbo].[T2]是子表,而子表的[c2]是一个有外键约束的字段。 View Code . (col1 ,col2 NVARCHAR ( 30 ) NULL ,col3 NVARCH

出现这个错误,香港虚拟主机,虚拟主机,是因为插入一个长度为0的值至有外键约束的字段内。

我们来做个实验,并尝试解决它。

首先创建两个表,[dbo].[T1]是主表,[dbo].[T2]是子表,免备案空间,而子表的[c2]是一个有外键约束的字段。

View Code

. ( col1 , col2 NVARCHAR(30) NULL, col3 NVARCHAR(30) NULL ) . ( c1 , c2 .(), c3 NVARCHAR(30) NULL ) GO

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template