Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Help needed for identifying DML Trigger event type

Author  Topic 

sneh sharma
Starting Member

4 Posts

Posted - 2008-06-19 : 06:14:22
Hi,

I have a query regarding DML Triggers.

I have created a trigger ON a table AFTER Insert, Update staement. In the trigger's body I am making a call to a stored procedure. In the procedure, I want to know the Trigger invoked due to which event : insert or Update as I have to handle bith the cases differently.
But I am not able to find out any SQL server function or property which can distinguish between INSERT and Update events of a trigger.

Waiting for the needful.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-06-19 : 06:39:59
Dupe http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=105140



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

PeterNeo
Constraint Violating Yak Guru

357 Posts

Posted - 2008-06-19 : 07:42:06
try this

SELECT TE.*
FROM sys.trigger_events AS TE
JOIN sys.triggers AS T
ON T.object_id = TE.object_id
WHERE T.name = <triggername>
-- AND T.parent_class = 0
Go to Top of Page
   

- Advertisement -