Msg 331, Level 16, State 1, Line 2
The target table ‘%.*ls’ of the OUTPUT INTO clause cannot have any enabled triggers.
This error message appears when you try to use the OUTPUT INTO clause for a target table which has triggers enabled.
The T-SQL statement can be parsed, but causes the error at runtime.
Errors of the Severity Level 16 are generated by the user and can be fixed by the SQL Server user. The statement cannot be executed this way. The target table of the OUTPUT INTO clause cannot have enabled triggers.
This error message was introduced with SQL Server 2005.
IF OBJECT_ID (‘dbo.t’) IS NOT NULL
DROP TABLE dbo.t;
IF OBJECT_ID (‘dbo.t2’) IS NOT NULL
DROP TABLE dbo.t2;
CREATE TABLE dbo.t
CREATE TABLE dbo.t2
CREATE TRIGGER dbo.t1_i ON dbo.t2
INSERT INTO dbo.t
SELECT 1, ‘a’;
In the above example we try to insert data into the table dbo.t2 via the OUTPUT INTO clause. Because dbo.t2 has enabled triggers, the error is raised.