469,918 Members | 2,256 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,918 developers. It's quick & easy.

Mass Update on Table with Trigger

Hi,

I need to update a field in about 20 records on a table. The table has
an update trigger (which updates the [lastedited] field whenever a
record is updated). As a result I'm getting an error: "Subquery
returned more than 1 value.", and the update fails.

Is there a way in the stored procedure to handle this issue?

thanks for your help.

Paul

Jun 29 '07 #1
2 4181
pa********@gmail.com wrote:
Hi,

I need to update a field in about 20 records on a table. The table has
an update trigger (which updates the [lastedited] field whenever a
record is updated). As a result I'm getting an error: "Subquery
returned more than 1 value.", and the update fails.

Is there a way in the stored procedure to handle this issue?
That's not an issue - it's pure ignorance. Probably someone assumed,
that only one record can be updated at a time. Trigger logic (if the
trigger is causing this error) must be changed to handle true set-based
operations.

--
Best regards,
Marcin Guzowski
http://guzowski.info
Jun 29 '07 #2
(pa********@gmail.com) writes:
I need to update a field in about 20 records on a table. The table has
an update trigger (which updates the [lastedited] field whenever a
record is updated). As a result I'm getting an error: "Subquery
returned more than 1 value.", and the update fails.

Is there a way in the stored procedure to handle this issue?
If you are not able to correct the trigger, you will have to run a
cursor to updaet one row at a time. But obviously that should be a very
last resort.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Jun 29 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Jason | last post: by
18 posts views Thread by Bill Smith | last post: by
13 posts views Thread by Neil | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.