The target table 'Employee' of the DML statement cannot have any enabled triggers if the statement contains an OUTPUT clause without INTO clause.

  • Hi Friends

    I Have a table Like Employee contating columns (Id (identity),Name Varchar)

    for this table i am creating a trigger for insert ,update, delete.

    When i am inseting to employee query is

    insert into employee(Name) output inserted.Id Values('Scott'),

    it is throwing below error

    'The target table 'Employee' of the DML statement cannot have any enabled triggers if the statement contains an OUTPUT clause without INTO clause.'

    Please Help Me.

    Thanks in advance

    Regards

    swamy.

  • The Output clause selects data. A trigger shouldn't do that. Output Into will store the data in a separate table, a temp table, or a table variable.

    What are you trying to do with the ID that you have in the Output clause?

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • Try Creating a Table Variable and get the output on the Table Variable.

    OUTPUT inserted.Id into @tablevariable.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply