tags:

views:

2099

answers:

2

I'm trying to do a simple update. I've done this kind of thing thousands of times.

update articles
set department = 60
where type = 'Top Story'

Today I get a strange error.

Describe Error: Failed to retrieve execution plan: Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.

Warnings: ---> W (1): The statement has been terminated. <---

1559 record(s) affected

There is no subquery in the update statement. What's going on?

+9  A: 

Most likely there is a trigger on the table, and the error is occurring in the trigger, not in your actual SQL statement.

I would further bet that the trigger assumes the insert or delete special tables will only ever have a single row (which is in fact not the case in mass updates, like the one you're executing), causing the problem.

technophile
Nice catch! The table has an update trigger containing this clause: "where articleID = (select articleID from INSERTED)"I changed the "=" to "in" and it worked as expected.
Patrick McElhaney
Wow. I ran across this last week and it drove me nuts. Come to find out, the guy before me slapped triggers in and didn't tell anyone. Thanks much!
Nazadus
A: 

i have the same problem.. but my table does not have a trigger