Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2003
    Posts
    51

    Unanswered: Row wise operation in MSSQL Server

    How can I create a row wise trigger in MSSQL Server .

    CREATE TRIGGER trigName ON tableName for
    INSERT , UPDATE , DELETE
    AS ...

    For a multiple delete , I got only one trigger invocation .
    But I need individual trigger calls for each row ...
    How can I do this in t-sql ?
    Is there any usage like FOR EACH ROW in Oracle ?
    Is it possible through INSTEAD OF TRIGGER ?
    Please help !!!!!!!!

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Yes, you could put a cursor in the trigger that operates on each row of the INSERTED table. But do yourself a favor and don't do it. Find a set-based solution using the INSERTED table instead.

    Please describe what you are trying to do and why you think you need a row-wise operator (cursor). These are generally only needed by dynamic sql procedures or processes where the results of the operation on one record affects the results of the operation on the next record.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  3. #3
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    AND...I'll add...anything that would require a cursor should not be done in a trigger...
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •