I'm working on a trigger in Microsoft SQL Server 2012
Here is what I have so far, following what I know to be proper syntax:
CREATE TRIGGER restore_trigger
ON dbo.Lead
AFTER DELETE OF id, firsname, lastname, postalcode, address,phone, email, title, managementlevel, lastcalldate, lastcallresult, companyid
REFERENCING OLD ROW as OldRow
FOR EACH ROW
INSERT INTO dbo.Lead
VALUES (OldRow.id, OldRow.firstname, OldRow.lastname, OldRow.postalcode, OldRow.address, OldRow.phone, OldRow.email,
OldRow.title, OldRow.managmentlevel, OldRow.lastcalldate, OldRow.lastcallresult, OldRow.companyid);
Microsoft SQL Server is throwing an error with the 'of' and all of the values from OldRow I want to insert in to dbo.Lead.
FOR EACH ROWclause, T-SQL does not supportAFTER DELETE of .......- and T-SQL doesn't support theOLDorNEWkeywords - you need to read the official MSDN documentation on the exact trigger syntax for T-SQL !!