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 2000 Forums
 Transact-SQL (2000)
 Disabling trigger

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-02-27 : 11:59:44
Girish writes "hi team,

i have notice that the trigger associate with a table gets fired after an insert/update statement even though there is 0 row getting inserted/updated. is there any way to stop the execution of the trigger if the no of rows getting effected is 0?

-Girish"

Kristen
Test

22859 Posts

Posted - 2006-02-27 : 13:08:39
Hi Girish, Welcome to SQL Team!

Something like this?

IF 0 = (SELECT COUNT(*) FROM inserted)
+ (SELECT COUNT(*) FROM deleted)
BEGIN
... bail out ...
END
ELSE
... do real stuff ...
END

Kristen
Go to Top of Page
   

- Advertisement -