I have the following Trigger which I cannot get to work on INSERT.
If I edit the record the trigger fires.
Please could someone point me in the right direction.
CREATE Trigger [dbo].[UpdateTerr] on [dbo].[Address]
for Update
as
begin
if update(addr_county)
begin
update Company set
comp_secterr = case addr_county WHEN 'BUX' THEN '-805306364' WHEN 'SRY' THEN '-536870909' WHEN 'OFE' THEN '-805306364' WHEN 'SUX' THEN '-268435454' WHEN 'BRK' THEN '-1342177274' WHEN 'KNT' THEN '-1073741819' WHEN 'SXE' THEN '-268435454' WHEN 'SXW' THEN '-268435454' WHEN 'IOW' THEN '1' WHEN 'HPH' THEN '1' WHEN 'MK' THEN '-805306364' ELSE '134217728' end
from inserted where Company.Comp_PrimaryAddres
sId = Inserted.Addr_AddressId
end
end
I have tried changing it to for Insert, Update
Cheers.
Mim
Start Free Trial