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)
 Trigger: Tell Insert vs Update

Author  Topic 

skillilea
Starting Member

15 Posts

Posted - 2009-08-25 : 20:25:06
If you create a trigger ie... AFTER INSERT, UPDATE

Is there a mode you can tell if it was an insert, update without doing some kind of EXISTS ...

ie.

IF @@TRIGGER_MODE = "INSERT" BEGIN

END ELSE BEGIN

END

tnx

cat_jesus
Aged Yak Warrior

547 Posts

Posted - 2009-08-26 : 08:32:01
I don't think so. However you can inspect the contents of the deleted table.

select count(*) from deleted

If it returns 0 it must be an insert.

An infinite universe is the ultimate cartesian product.
Go to Top of Page
   

- Advertisement -