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
 SQL Server Development (2000)
 Triggers

Author  Topic 

ramdas
Posting Yak Master

181 Posts

Posted - 2003-05-16 : 15:09:34
Hi Folks,
I have a trigger on a table for Insert and Update. I want to perform the actual logic if only 1 or more rows have been affected. What should I use to check the number of rows affected within a trigger.

Bye

Ramdas Narayanan
SQL Server DBA

simondeutsch
Aged Yak Warrior

547 Posts

Posted - 2003-05-16 : 15:27:34
SELECT COUNT(*) FROM Inserted for INSERT triggers, or SELECT COUNT(*) FROM Deleted/SELECT COUNT(*) FROM Inserted for UPDATE Triggers.
Actually, if an update affects no rows, will the trigger fire?

Sarah Berger MCSD
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2003-05-16 : 15:35:19
quote:

Hi Folks,
I have a trigger on a table for Insert and Update. I want to perform the actual logic if only 1 or more rows have been affected. What should I use to check the number of rows affected within a trigger.

Bye

Ramdas Narayanan
SQL Server DBA



Never heard of a trigger firing when @@ROWCOUNT = 0

Do you mean more than 1 row?



Brett

8-)
Go to Top of Page

vadood
Starting Member

7 Posts

Posted - 2003-05-17 : 09:50:14
I think an INSTEAD OF trigger may fire in any circumstance, not?

Go to Top of Page
   

- Advertisement -