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 |
|
jgrant
Yak Posting Veteran
69 Posts |
Posted - 2008-03-10 : 15:03:54
|
| Is there a way to determine how many rows were deleted using a database trigger. I reviewed the sys.trigger_events but could not find where you might determine how many rows were deleted.The Yak Village Idiot |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2008-03-10 : 15:18:33
|
| Look at triggers, object identifiers in BOL:DML trigger statements use two special tables: the deleted table and the inserted tables. SQL Server 2005 automatically creates and manages these tables. You can use these temporary, memory-resident tables to test the effects of certain data modifications and to set conditions for DML trigger actions. You cannot directly modify the data in the tables or perform data definition language (DDL) operations on the tables, such as CREATE INDEX.Jim |
 |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2008-03-10 : 15:20:43
|
| @@rowcount as well! |
 |
|
|
jgrant
Yak Posting Veteran
69 Posts |
Posted - 2008-03-10 : 19:44:31
|
| I have used @@rowcount before. How would you use @@rowcount within a database trigger?The Yak Village Idiot |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2008-03-10 : 20:17:16
|
| Just capture @@ROWCOUNT as the first line in your trigger.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/ |
 |
|
|
jgrant
Yak Posting Veteran
69 Posts |
Posted - 2008-03-10 : 21:17:58
|
| Thank you everyone.The Yak Village Idiot |
 |
|
|
|
|
|