Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Triggers

katukhakatukha Member Posts: 10
Hi
Is is possible to get SQL Server triggers to execute per
row. Ex. When i issue stm Delete from table where key
= "***" and i have 3 entries, only 1 delete stm is
executed, but 3 row deleted. I want my trigger to execute
3 times, meaning, i need trigger per row
How can i do that

Thank you

Comments

  • Anjuna MoonAnjuna Moon Member Posts: 89
    Hi, even though the Delete statement is only executed once, the Trigger is set off for each row affected

    For example:

    CREATE TRIGGER [cascade_delete_company] ON [company]
    FOR DELETE
    AS
    select id from deleted

    The keyword here is "deleted" which represents the row just deleted. Just use this in the way you need.

    /Chris


    : Hi
    : Is is possible to get SQL Server triggers to execute per
    : row. Ex. When i issue stm Delete from table where key
    : = "***" and i have 3 entries, only 1 delete stm is
    : executed, but 3 row deleted. I want my trigger to execute
    : 3 times, meaning, i need trigger per row
    : How can i do that
    :
    : Thank you
    :
    :

  • Chris BrownChris Brown USAMember Posts: 4,624 ✭✭

    < http://forcoder.org /> free ebooks and video tutorials about ( C PHP Perl Swift PL/SQL Java C++ Scratch Visual Basic .NET MATLAB R JavaScript C# Visual Basic Objective-C Go Ruby Python Assembly Delphi Alice Hack Erlang F# LabVIEW Awk Prolog Lua Clojure ABAP Julia Logo VBScript Rust ML Kotlin Lisp Scheme Fortran Scala SAS Bash Crystal Ada Dart D Apex COBOL FoxPro Transact-SQL ) _________

Sign In or Register to comment.