Re: Error on Trigger Launch



On Wed, 27 Feb 2008 03:57:04 -0800 (PST), pyrahna wrote:

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.

Hi pyrahna,

I only now see your own follow up message about the SET NOCOUNT. Yes,
omitting this command at the beginning of a trigger or stored procedure
results in extra results being sent to the client, which can cause all
kind of problems.

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.

The ideal method would be to replace the entire trigger with a single
set-based logic. However, the trigger code is too complicated and too
long for me to try this from here and in my spare time. So either you do
that yourself, or you take a shortcut and simply use a cursor to process
all rows in the "inserted" pseudo table one by one.

Note that a cursor in a trigger is NOT generally recommended since it
hurts performance, but each rule has its exceptions.

--
Hugo Kornelis, SQL Server MVP
My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
.



Relevant Pages

  • Re: Problem Executing a Stored Proc within a cursor
    ... I will never use Exists again, current versions of SQL server may have ... that you have a strange way of running the cursor loop. ... DECLARE cur CURSOR STATIC LOCAL FOR ...
    (microsoft.public.sqlserver.programming)
  • Re: application roles
    ... I 've made a trigger on a SQL2000 database to test your solution with the ... But my login-account and database user appear in my logtable instead of the ... if you are on SQL 2005. ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ...
    (microsoft.public.sqlserver.security)
  • RE: Problem Executing a Stored Proc within a cursor
    ... that you have a strange way of running the cursor loop. ... DECLARE cur CURSOR STATIC LOCAL FOR ... Always make the cursor STATIC, which means that SQL Server will ...
    (microsoft.public.sqlserver.programming)
  • Re: Update trigger
    ... nvltrigger for each column for example. ... SQL> drop trigger emp_upd_trig ... SQL> create table emp ( ... Commit complete. ...
    (comp.databases.oracle.server)
  • Re: Transaction Abort in a trigger SQL 2008, writing to event log
    ... creating another transaction within the trigger. ... Links for SQL Server Books Online: ...
    (microsoft.public.sqlserver.programming)