I’m more familiar with Oracle so the syntax of SQL Server 2008 is throwing me. I’m trying to perform an update of multiple rows with a query equivalent to
update Table
set type = 'typeA'
where id in
(select id from Table where type='typeB')
I am receiving the following error:
Msg 512, Level 16, State 1, Procedure Assigned_To_Email, Line 19
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
Searching for a TSQL specific solution I tried the following syntax but received the same error.
update a
set type = 'typeA'
from Table a
join Table b
on a.id = b.id
where b.type='typeB'
I’ve read that an update with the subquery should work, but it’s not been my experience. Is there something more basic missing here?
Thanks for any help!
Your update statement does not have to use a sub-query or a join.