Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Server 2000: "subquery returned more than one value" on an update statement

Tags:

sql-server

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?

like image 391
Patrick McElhaney Avatar asked Aug 06 '26 20:08

Patrick McElhaney


1 Answers

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.

like image 141
technophile Avatar answered Aug 10 '26 14:08

technophile



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!