Home > Archive > MS SQL Server > January 2006 > Trigger for each row









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Trigger for each row
jouj

2006-01-30, 9:23 am

Hi,
MS SQL 2000.

In some tables, my triggers on INSERT,UPDATE and DELETE are written using
several UDF, and testings (large T-SQL Code). that's why I should use a
cursor to run my code for each row affected by an Insert, Update and Delete.

1-Is there a better way to do this without using cursors?
2-And is there a way so that the tirgger fires on each row? (one row in
inserted/deleted tables).

reference:
[Quote from BOL]
Note The use of cursors in triggers is not recommended because of the
potentially negative impact on performance. Use rowset-based logic rather
than cursors to design a trigger that affects multiple rows.
[/Quote]

Regards
jouj
Jens

2006-01-30, 9:23 am

If you are using UDFs, there is a chance to do this on a swetbased
command. But unless you don=B4show us your code, we can help you
further. The inserted / deleted data us present within the INSERTED and
DELETED tables, so you can use them by joining to the existing (if any)
data.

HTH, jens Suessmeyer.

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com