INSTEAD OF TRIGGER-WITHOUT ROLLBACK

Discussion in 'MCSD' started by Kaimuri, Jan 6, 2005.

  1. Kaimuri

    Kaimuri Guest

    I saw a comment in a book that in this INSTEAD OF Trigger, the fact that
    there is no rollback is an advantage. How is that?

    CREATE TRIGGER InsOrdDet ON [Order Details] INSTEAD OF INSERT AS DECLARE
    @qty int SELECT @qty=quantity FROM Inserted IF @qty<=(SELECT UnitsInStock

    FROM Products P JOIN Inserted I

    ON P.ProductID=I.ProductID)

    INSERT INTO [Order Details]

    SELECT * FROM Inserted

    ELSE

    RAISERROR('Not enough products in stock', 16, 1)
     
    Kaimuri, Jan 6, 2005
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.