I need to create a trigger to add a record to second table.
tab_esami
tab_valutazioni
I create this trigger :
CREATE TRIGGER [dbo].[NewTrigger]
ON [dbo].[tab_esame]
AFTER INSERT
AS
BEGIN
/* Trigger action goes here. */
SET IDENTITY_INSERT TAB_VALUTAZIONI ON
INSERT INTO tab_valutazioni(tab_utenti_id, nume_colesterolo,
nume_hdl, nume_ldl, nume_trigliceridi,
nume_glicemia, data_insert)
SELECT
id_paziente, colesterolo_totale,
hdl, ldl, trigliceridi,
glicemia, data_esame
FROM
INSERTED
END
GO
But when I try to insert a record into tab_esami
I get an error :
Can you help me?
The id
column for tab_valutazioni
is 'ID' and it is a primary key with autoincrement properties..
Thanks
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.