Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Inserted table
Message
 
 
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Title:
Miscellaneous
Thread ID:
00624840
Message ID:
00624905
Views:
14
This message has been marked as the solution to the initial question of the thread.
See @@CURSOR_ROWS in BOL.

>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
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform