HOW TO RESTRIC INSERT IN A TABLE

  • HI, I HAVE A TABLE CALLED SERVICE_REQUEST AND I NEED TO AVOID INSERTS OF NEW RECORS, UPDATES ARE ALLOWED.

    DATABASE USERS ARE SYSTEM ADMINISTRATOR AS SERVER FUNCTIONS.

    WHAT CAN I DO?

     

     

  • Write a trigger that doesn't allow inserts.  Instead of trigger.

    Tom

  • hi, I've implemented this.

    IF EXISTS (SELECT name FROM sysobjects

          WHERE name = 'NOT_FOR_INSERT' AND type = 'TR')

       DROP TRIGGER NOT_FOR_INSERT

    CREATE TRIGGER NOT_FOR_INSERT

    ON SERVICE_REQUEST

    FOR INSERT

    AS RAISERROR (50009, 16, 10)

    ROLLBACK TRANSACTION

    GO

     

     

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply