I'm trying to insert another row into a table whenever a row is inserted using a trigger, but get the following error message:
The target table 'EDDSDBO.Redaction' of the DML statement cannot have any enabled triggers if the statement contains an OUTPUT clause without INTO clause.
Any help creating a work-around for this would be greatly appreciated.
From reading the links below my code is currently the following
Cannot use UPDATE with OUTPUT clause when a trigger is on the table
Code:
ALTER TRIGGER [EDDSDBO].[AddLabel]
ON [EDDSDBO].[Redaction]
AFTER INSERT
AS
BEGIN
DECLARE @T TABLE (
[FileGuid] VARCHAR, [X] INT, [Y] INT, [Width] INT, [Height] INT
)
INSERT INTO [Redaction] [FileGuid],[X],[Y],[Width],[Height]
OUTPUT [inserted].[FileGuid], [inserted].[X], [inserted].[Y],
[inserted].[Width], [inserted].[Height]
INTO @T
SELECT
[inserted].[FileGuid], [inserted].[X], [inserted].[Y], 70, 35
FROM
inserted
SELECT *
FROM @T
END
The INSERT
code was originally the following before reading the links described:
INSERT INTO [Redaction]
[FileGuid],[X],[Y],[Width],[Height]
SELECT TOP 1
[FileGuid], [X], [Y], 70, 35
FROM [Redaction] AS r1
ORDER BY [ID] DESC
UPDATE: Turns out that kCura's Relativity platform does not allow inserting with triggers, so this was futile...