robincbailey
IS-IT--Management
A trigger that was working, has for some reason stopped firing.
I know that the trigger has not changed, but what else could be causing this?
CREATE TRIGGER copy_across
ON dbo.rms_inventory_temp
FOR UPDATE, INSERT
AS
DECLARE
@inventid VARCHAR(16),
@description VARCHAR(30),
@location VARCHAR(30),
@commsconnect VARCHAR(25),
@model VARCHAR(10),
@department VARCHAR(8)
SELECT
@inventid=r.inventid,
@description=r.description,
@location=r.location,
@commsconnect=r.commsconnect,
@model=r.model,
@department=r.department
FROM rms_inventory_temp r
IF @inventid=''
BEGIN
Update rms_inventory_temp
set inventid=RMS_badge_numbers.devicename
from RMS_badge_numbers
where rms_inventory_temp.computer_idn=RMS_badge_numbers.computer_idn
END
IF @inventid<>'' and @description<>'' and @location<>'' and @commsconnect<>'' and @model<>'' and @department<>''
BEGIN
insert into rms_inventory_changes
(
prodname,
location,
ip,
inventid,
model,
department
)
select
description,
location,
commsconnect,
inventid,
model,
department
from inserted
where @inventid<>'' and @description<>'' and @location<>'' and @commsconnect<>'' and @model<>'' and @department<>''
END
Delete from rms_inventory_temp where inventid in (select inventid from rms_inventory_changes)
I know that the trigger has not changed, but what else could be causing this?
CREATE TRIGGER copy_across
ON dbo.rms_inventory_temp
FOR UPDATE, INSERT
AS
DECLARE
@inventid VARCHAR(16),
@description VARCHAR(30),
@location VARCHAR(30),
@commsconnect VARCHAR(25),
@model VARCHAR(10),
@department VARCHAR(8)
SELECT
@inventid=r.inventid,
@description=r.description,
@location=r.location,
@commsconnect=r.commsconnect,
@model=r.model,
@department=r.department
FROM rms_inventory_temp r
IF @inventid=''
BEGIN
Update rms_inventory_temp
set inventid=RMS_badge_numbers.devicename
from RMS_badge_numbers
where rms_inventory_temp.computer_idn=RMS_badge_numbers.computer_idn
END
IF @inventid<>'' and @description<>'' and @location<>'' and @commsconnect<>'' and @model<>'' and @department<>''
BEGIN
insert into rms_inventory_changes
(
prodname,
location,
ip,
inventid,
model,
department
)
select
description,
location,
commsconnect,
inventid,
model,
department
from inserted
where @inventid<>'' and @description<>'' and @location<>'' and @commsconnect<>'' and @model<>'' and @department<>''
END
Delete from rms_inventory_temp where inventid in (select inventid from rms_inventory_changes)