Whenever I have a row inserted in a table, I want a trigger procedure to insert a row into another tabel with data from the first insterted row.
I thought it would be like this:
CREATE TRIGGER AddReferalmail
ON tblLeider
FOR INSERT
AS
INSERT INTO tblMail (Mail_ID, HagelMail)
VALUES (NEW.Leider_Id, New.Voornaam + '.' + New.Achternaam + '@Hagelstein.be')
GO
But this gives me the following error:
Server: Msg 128, Level 15, State 1, Procedure AddReferalmail, Line 6
The name 'Leider_Id' is not permitted in this context. Only constants, expressions, or variables allowed here. Column names are not permitted.
I use SQL Server 2000
I thought it would be like this:
CREATE TRIGGER AddReferalmail
ON tblLeider
FOR INSERT
AS
INSERT INTO tblMail (Mail_ID, HagelMail)
VALUES (NEW.Leider_Id, New.Voornaam + '.' + New.Achternaam + '@Hagelstein.be')
GO
But this gives me the following error:
Server: Msg 128, Level 15, State 1, Procedure AddReferalmail, Line 6
The name 'Leider_Id' is not permitted in this context. Only constants, expressions, or variables allowed here. Column names are not permitted.
I use SQL Server 2000