Groups | Blog | Home
all groups > sql server programming > december 2004 >

sql server programming : Dealing with Triggers


Alejandro Mesa
12/27/2004 10:29:04 AM
[quoted text, click to view]

It depends on what you are trying to accomplish. Try first to find a set
based solution and leave cursors as the last resource in your pocket.



AMB

[quoted text, click to view]
Jonh Smith
12/27/2004 2:23:21 PM
Hello, Leila

In this case you can use two special tables inserted and deleted
(memory-resident tables)
For example for trigger for delete:

CREATE TRIGGER myTrigger ON [dbo].[myTable]
FOR DELETE AS
SELECT * FROM deleted






[quoted text, click to view]

John Bell
12/27/2004 6:29:20 PM
Hi

If there is specific activities that requires single row processing then you
will have to use a cursor, but if you find a set based solution it is more
likely to be quicker. Without seeing the code it is hard to comment further.

John

[quoted text, click to view]

Leila
12/27/2004 9:32:04 PM
Hi,
My delete trigger on a table assumes that one record is being deleted each
time. But there may be situations that many rows be affected by a delete
statement.
How can I process these records individually in Deleted table? Should I
necessarily use cursors or..?
Any help would be greatly appreciated.
Leila

AddThis Social Bookmark Button