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.
| 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.ByeRamdas NarayananSQL 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 |
 |
|
|
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.ByeRamdas NarayananSQL Server DBA
Never heard of a trigger firing when @@ROWCOUNT = 0Do you mean more than 1 row?Brett8-) |
 |
|
|
vadood
Starting Member
7 Posts |
Posted - 2003-05-17 : 09:50:14
|
| I think an INSTEAD OF trigger may fire in any circumstance, not? |
 |
|
|
|
|
|