I have two tables, first with parts, second with orders. In orders i store IDPart and quantity of this part. I would like achieve that when inserting the IDPart and Quantity values into the Orders, the trigger automatically fires up to calculate the price. Did someone can help to figure it out?
CREATE TABLE Parts ( ID INT IDENTITY(1,1) PRIMARY KEY, PartName NVARCHAR(70), Price NVARCHAR(70) ) CREATE TABLE Orders ( ID INT IDENTITY(1,1) PRIMARY KEY, IDPart INT REFERENCES Parts(ID), Quantity INT, Price DECIMAL(6,2) )