View Single Post

   
  #7 (permalink)  
Old 03-01-2008, 02:49 PM
Erland Sommarskog
 
Posts: n/a
Default Re: Error on Trigger Launch

pyrahna (pltaylor3@gmail.com) writes:
> It was an error message from Microsoft SQL Server Managment Studio
> front end....not technically a sql message but i would hope that it
> would handle error messages decently.


The Open Table thing in Mgmt Studio is fairly crappy in my opinion. I never
use it myself.

> As for the select statement that has been pointed out by two people
> now I don't see it being a problem in the application, but I am
> interested in possible solutions and work arounds so that the problem
> doesn't exist and so Ii can better at this.
> thank you for your time


You could set up a cursor that loops over inserted, if you think that
multi-row updates are rare.

Or you can be this brutal and add this first in the trigger:

IF @@rowcount > 1
BEGIN
ROLLBACK TRANSACTION
RAISERROR('Multi-row updates are not permitted on this table', 16, 1)
RETURN
END



--
Erland Sommarskog, SQL Server MVP, esquel@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
Reply With Quote