Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2003
    Location
    In your thoughts
    Posts
    195

    Unanswered: Before Update/Delete Trigger

    Is there a way to create a trigger that will keep a user from updating or deleting a record? Thanks, Jeremy
    Nothing better than a good ride.

  2. #2
    Join Date
    Apr 2003
    Location
    Israel
    Posts
    81
    Read about INSTEAD OF triggers in BOL
    --
    kukuk

  3. #3
    Join Date
    Jun 2003
    Posts
    7

    Re: Before Update/Delete Trigger

    Hi JCScoobyRS,

    Originally posted by JCScoobyRS
    Is there a way to create a trigger that will keep a user from updating or deleting a record? Thanks, Jeremy
    äh, why don't you revoke the user the UPDATE and DELETE permission?

  4. #4
    Join Date
    Feb 2003
    Location
    In your thoughts
    Posts
    195
    Very good idea BUT I'm trying to help a buddy out that needed the ability described in my first post. Is there a way? I'll check with him to see if that will work but I wouldn't mind an answer anyways. Thanks for your help, Jeremy
    Nothing better than a good ride.

  5. #5
    Join Date
    Jun 2003
    Posts
    7
    Originally posted by JCScoobyRS
    Very good idea BUT I'm trying to help a buddy out that needed the ability described in my first post. Is there a way? I'll check with him to see if that will work but I wouldn't mind an answer anyways. Thanks for your help, Jeremy
    In this case you should go for INSTEAD OF triggers

  6. #6
    Join Date
    Feb 2003
    Location
    In your thoughts
    Posts
    195
    Okay...that sounds good. Here is an example of what I need to do:

    I'm trying to prevent the UPDATE and DELETE on a table after a certain field has been entered(not null). Here is the trigger right now:

    Code:
    CREATE TRIGGER TRANSACTION_REPORTEE ON [dbo].[TRAVAUX_COMMANDE] 
    FOR UPDATE, DELETE 
    AS
    IF [dbo].[TRAVAUX_COMMANDE].[Id_Transaction_GL] IS NOT NULL
    BEGIN 
    	RAISERROR ('Impossible de modifier une ligne reportée',10,1)
    	ROLLBACK TRAN
    END
    This is what my buddy has. Is there anyway to take what he has here and revise it with your idea in it for testing? Thanks alot, Jeremy
    Nothing better than a good ride.

Posting Permissions

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