One of our offices is running a special, the fee for services is less than normal
I don't have access to the code that adds the fee, so I figured a trigger would work.
I'm creating a trigger to change a fee inserted into the database if the purchase originated from that specific office. Ive never created a trigger so bear with me.
I've tried to update the "inserted" table to reflect the fee that I want, but learned that is the wrong approach (see below).
If anybody has an example of similar functionality thank you in advance.
CREATE TRIGGER FixFee ON [dbo].[fees]
FOR INSERT
AS
IF EXISTS
(
SELECT * FROM purchase p JOIN inserted i ON p.file_id = i.file_id WHERE p.site_id = 22
)
BEGIN
Update Inserted SET total = '595.00' WHERE file_id = file_id
END
I don't have access to the code that adds the fee, so I figured a trigger would work.
I'm creating a trigger to change a fee inserted into the database if the purchase originated from that specific office. Ive never created a trigger so bear with me.
I've tried to update the "inserted" table to reflect the fee that I want, but learned that is the wrong approach (see below).
If anybody has an example of similar functionality thank you in advance.
CREATE TRIGGER FixFee ON [dbo].[fees]
FOR INSERT
AS
IF EXISTS
(
SELECT * FROM purchase p JOIN inserted i ON p.file_id = i.file_id WHERE p.site_id = 22
)
BEGIN
Update Inserted SET total = '595.00' WHERE file_id = file_id
END