MS SQL update problem

QuinnDester
QuinnDester used Ask the Experts™
on
I want to update about 150 rows in a table.

I cant understand why this isnt working I tryed writing the update in 2 ways both gave the same error see below

i have entered both queries in the code block

update MyTable set thisfield = 'thisText' where thatField = 'thatText')

Msg 512, Level 16, State 1, Procedure COMMISIONTYPE, Line 4
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
The statement has been terminated.
update MyTable set thisfield = 'thisText' where thatField = 'thatText'
 
 
update MyTable set thisfield = 'thisText' 
where thisRowid in(
select thisRowid from MyTable 
where thatField = 'thatText')

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

What is the error with the first wasy?

update MyTable set thisfield = 'thisText' where thatField = 'thatText'


~
Awarded 2008
Awarded 2008
Commented:
You likely have a trigger on your MyTable table that is causing your problem.

Author

Commented:
Perfect, Thank you Thats is exactly what it was.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial