General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only