Nuevamente, ¿cuál es la razón para crear esta redundancia?
No ha mostrado DDL para la tabla `articulos`. Infiriendo su estructura a partir de tu Trigger, tengo...
drop table if exists articulos, links;
create table articulos (
codinterno int primary key,
codigo varchar(20) character set latin1 default null,
descripcion varchar(60) character set latin1 default null,
master varchar(20) character set latin1 default null
);
create trigger `articulos_graba_links` after insert on `articulos` for each row
insert into links(codinterno,codigob,descripcion,master)
values(new.codinterno,new.codigo,new.descripcion,new.codigo);
create table `links` (
`id` int not null auto_increment,
`codinterno` int default null,
`codigob` varchar(20) character set latin1 default null,
`descripcion` varchar(60) character set latin1 default null,
`master` varchar(20) character set latin1 default null,
primary key (`id`),
unique key `porcodigob` (`codigob`),
key `porcodinterno` (`codinterno`),
key `pormaster` (`master`)
) engine=innodb auto_increment=6105 default charset=latin1 collate=latin1_bin;
insert into articulos values
(1,'abc','abc','abc'), (2,'def','def','def');
select * from links;
+------+------------+---------+-------------+--------+
| id | codinterno | codigob | descripcion | master |
+------+------------+---------+-------------+--------+
| 6105 | 1 | abc | abc | abc |
| 6106 | 2 | def | def | def |
+------+------------+---------+-------------+--------+
Edited 1 time(s). Last edit at 01/29/2022 09:34AM by Peter Brawley.