April 21, 2009 at 12:08 pm
This delete statement gives me an error:
delete from transtatushistory
where transtatusidold <> 17
and tranid = 5030
I get the error:
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
The corresponding select statement correctly gives me the records that I want to delete:
select * from transtatushistory
where transtatusidold <> 17
and tranid = 5030
What am I doing wrong?
April 21, 2009 at 12:14 pm
I don't see anything wrong with the delete statement. Is there anything else in your batch?
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
April 21, 2009 at 12:26 pm
Thanks for your quick response. There was a trigger on the table that was giving me the error. I disabled it and now it works.
April 21, 2009 at 12:36 pm
Susan Moore (4/21/2009)
Thanks for your quick response. There was a trigger on the table that was giving me the error. I disabled it and now it works.
Triggers, yes, those can cause unexpected results.
April 21, 2009 at 12:47 pm
Ah yes, the hidden code of triggers. I would recommend re-writing the trigger to handle a set based delete properly.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
April 21, 2009 at 12:51 pm
Great idea. I'll take care of it. Thanks for everyone's help.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply