我正在尝试使用 sql server 2012 在表中插入值,但出现此错误:
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Fabricante".
The conflict occurred in database
"practica", table "dbo.Fabricantes", column 'Codigo'.
我只有两张桌子。
这是我用来创建表格的代码
create table Fabricantes(
Codigo int identity primary key,
Nombre nvarchar (100) not null)
create table Articulos(
Codigo int identity primary key,
Nombre nvarchar (100) not null,
Precio int,
Fabricante int,
constraint FK_Fabricante foreign key
(Codigo) references Fabricantes (Codigo))