DbContext.Savechanges() throwing error in entity frameworkcore1.0 with trigger RRS feed

  • Question

  • I have a table in sql server which is having a trigger when i insert data using dbcontext.savechanges() with entityframeworkcore1.0

    throwing error like The target table 'tablename' of the DML statement cannot have any enabled triggers if the statement contains an OUTPUT clause without INTO clause.Can you help me how to resolve


    Raghu S

    Tuesday, July 26, 2016 3:45 PM

All replies

  • This is not an EF issue. It's a DB engine issue on the trigger. Did you use Bing or Google to lookup the error message for a possible resolution? You should post the DB engine forum, like MSDN MS SQL server forum.
    Tuesday, July 26, 2016 10:33 PM
  • Hi Raghu_Sanapathi6262,

    >>Can you help me how to resolve

    According to your description, it seems that you database use trigger.

    The OUTPUT clause may be useful to retrieve the value of identity columns or computed columns after an INSERT or UPDATE operation.  One restriction of the OUTPUT clause without also specifying the INTO keyword, as this error message suggests, is that the target of the DML operation, whether an INSERT, UPDATE, DELETE or MERGE operation, cannot have any enabled UPDATE triggers.

    and the following link provide a solution to avoid it.

    To overcome this restriction, one thing that can be done is to insert the newly inserted products together with the system-assigned product IDs into a temporary table or a table variable first. Then after the INSERT statement, these new products can now be returned to the calling application.

    Best regards,

    Cole Wu

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, July 27, 2016 2:44 AM