views:

208

answers:

1

I'm having an issue with a trigger that inserts a value into the same tabled on a linked server. Here is the trigger in question ...

USE [localDB]
GO
/****** Object:  Trigger [dbo].[INS_New_Row]    Script Date: 05/26/2009 10:50:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:   <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
ALTER TRIGGER dbo.INS_New_Row
   ON  LOCALDB.dbo.WIQ
   AFTER INSERT
AS 
BEGIN
    INSERT INTO
     DRSERVER.LOCALDBCLONE.dbo.WIQ
    SELECT
              column1,
              column2,
              column3
    FROM
     inserted
END

When I insert a row into LOCALDB.dbo.WIQ from my application I receive the following errror ...

System.Data.SqlClient.SqlException: The target table 'WIQ' of the DML statement cannot have any enabled triggers if the statement contains an OUTPUT clause without INTO clause.

The issue is I don't have any OUTPUT clauses in this (or any other) trigger defined on the table, nor does the target table have any triggers defined on it.

I'm not sure why I'm getting this error. The strange thing is, if I insert values into the columns from the SQL Server Management Studio, the trigger runs fine and the row is duplicated into the DRSERVER, it's only from the Application that gets an error.

The application in question is a Windows Service written in C# that inserts rows into LOCALDB.dbo.WIQ.

Thank you,

Scott Vercuski

A: 

As it turns out, one of the components that was called from my application involved a stored procedure that inserted the data into the table and had an OUTPUT clause in it. I wasn't aware that was how this component functioned and I was able to make changes to alleviate the error.

Thank you to everyone who read/pondered my question.

Scott Vercuski