You need to do always treat Triggers as set-theory stuff... (or if you
must, a cursor)
-- warning, in the absence of schema this was validated in GMAIL
CREATE TRIGGER updateContactCallTreeTotalsTrigger
ON CallTreeContacts
AFTER INSERT, UPDATE, DELETE
AS
SET NOCOUNT ON
-- Subtract old counts
UPDA
Here is a link to the now infamous trigger:
http://rafb.net/p/xYOA4j39.html
[EMAIL PROTECTED]> Date: Tue, 12 Feb 2008 16:28:20 +> From: [EMAIL
PROTECTED]> Subject: Re: [ADVANCED-DOTNET] Trigger and multiple values in the
inserted table> To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM> > > HiThe m
HiThe min and max effect will not cause an error but the main problem is that I
have multiple entries in the inserted table and i am trying to pull one
value.Here is my trigger at the moment and it is an obscenity. I am really
stuck what to do on this one:
USE ncontinuity2
IF EXISTS (SELECT na
Hi Paul,
You could try something like this:
Select
@RoleType = Min(CallTreeContactRoleId)
From
CallTreeContacts CTC
Join Inserted I On CTC.Uid = I.UID
A few points I have to make:
- You may get multiple role types - without knowing more about your trigger,
I cannot help you.
- If you can e
On Tue, 12 Feb 2008 15:43:14 +, Paul Cowan <[EMAIL PROTECTED]> wrote:
>Hi all,
>To cut a long strory short I have a trigger where I want to update some
totals on another table.
>THe thing is I have the following line:
>SET @roleType = (SELECT cc.calltreecontactroleid FROM CallTreeContacts cc
W
Hi Paul,
You could just remove the IN clause and use an INNER JOIN between the
CallTreeContacts table and the inserted one. You would eventually come
up with a set of values, so you need to replace your initial "SET
@roleType =" with an ad hoc query.
If you need additional hints please post some
Hi all,
To cut a long strory short I have a trigger where I want to update some totals
on another table.
THe thing is I have the following line:
SET @roleType = (SELECT cc.calltreecontactroleid FROM CallTreeContacts cc WHERE
cc.[Uid] IN (SELECT [Uid] FROM inserted))
This works if I update one row