Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Inserted table
Message
From
25/02/2002 17:34:33
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Title:
Inserted table
Miscellaneous
Thread ID:
00624840
Message ID:
00624840
Views:
39
Hi,

New to SQL Server Triggers. My understanding is that when a field is updated, the old row is inserted into a temporary table called 'deleted' and the new data is written into a temporary table called 'inserted'.

I'm trying to access the new data in a trigger (in order to update a second table) by doing a select on the 'inserted' table. The problem: the select on the 'inserted' table never returns any rows. Is this the right approach? If not, what would be the right approach?

The code within the trigger:


CREATE TRIGGER trUpdateAnalVerification ON
[ERA_IL_Study_Analytes_Verification]
FOR UPDATE AS

DECLARE newdata2 CURSOR FOR
SELECT study FROM inserted

OPEN newdata2

/*See if any rows were opened*/
INSERT gerrystest VALUES(CAST(GETDATE() AS varchar(25)) + ', after open, ' + CAST(@@ROWCOUNT as char(5)


CLOSE newdata2
DEALLOCATE newdata2
Next
Reply
Map
View

Click here to load this message in the networking platform