简体   繁体   中英

EF 6 delete fails with The select list for the Insert statement contains more items than the insert list

My EF Remove fails with the above statement. The table (Product) has a single primary key (ProductID). Running SQL Trace produced the following SQL that causes the failure:

exec sp_executesql N'DELETE [dbo].[Product] WHERE ([ProductID] = @0)',N'@0 int',@0=620895

Full error statement:

Msg 121, Level 15, State 1, Procedure t_del_Product, Line 8 The select list for the INSERT statement contains more items than the insert list. The number of SELECT values must match the number of INSERT columns.

Other similar Removes work just fine. My EDMX is fully updated against the DataSource (SQL Server 2012)

Any ideas? Anyone? Anyone? Thanks!

UPDATE: I should have tried this earlier, but I get the same error even with a simple: DELETE FROM Product Where ProductID = 620895 So, it is not EF.

As mentioned in my comment:

It looks like the sp is being called (possibly) when a delete occurs on dbo.Product and is producing your error. Just look on the table and see if there are triggers defined on it.

If indeed there is a trigger on the table calling this SP, then this is likely your issue and you should look into fixing the SP.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM