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)
 Delete Trigger

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-09-13 : 08:29:57
Prathiba writes "Suppose if I write a delete trigger for a table and if the deletion affects multiple rows based on a single id, I can see only the last row in the 'deleted' table. Please give me a fix to this so that I can get all the rows that are deleted.

Ex: A table contains 7 rows with the same id. Ex:

DockMst
=======
1. DockID
2. DockName

DockID = 10. It has 7 rows. If I delete from this table where dockid = 10 it will affect 7 rows but when i select records from the 'deleted' table I get only the last row.

Please give me a fix to this so that I can get all the rows that are deleted."

nr
SQLTeam MVY

12543 Posts

Posted - 2004-09-13 : 14:25:58
>> when i select records from the 'deleted' table I get only the last row.
No you don't - you get all the rows.
I suspect you are trying to set a variable somewhere which of course will only be set to the last value.
have a look at
http://www.nigelrivett.net/Triggers_1_A_beginners_guide.html



==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -