Prevent Record Deletion

  • SQL Server 2016. Used as a front-end to an Access database app for an employee database.

    In the Employee table, there is never a good reason to delete a row. How can I set rights on the server, such that the user cannot delete any record from the employee table?

    I've tried:  DENY DELETE ON OBJECT::dbo.EMPLOYEE TO sysadm;

    But can still delete records.

  • How are the users of the access database authenticated in SQL Server?

  • Using an ODBC connection.

  •  

    Are the users authenticated using integrated security or seperate sQL Server accounts or does the Access application connect using one SQL Server login or application group?

  • I've created 1 SQL Server account. The ODBC connection string is coded in the app. When the app opens, it establishes the ODBC connection. So all users are using the same SQL account.

  • Is this a direct DELETE statement - or are they calling a stored procedure to perform the delete?  If calling a procedure - and they have execute permissions on the procedure then they can run that code and it will execute.

    If this a delete option from a form - that is directly tied to the table - and the user account has not been granted DELETE or has been denied DELETE on the object then they should not be able to delete from the table.

    My guess is - either a stored procedure or the DENY is not applied to the correct login/user or the login has elevated rights (sysadmin?).

    Jeffrey Williams
    “We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”

    ― Charles R. Swindoll

    How to post questions to get better answers faster
    Managing Transaction Logs

  • Hmmm... maybe an "Instead-of" trigger to reject DELETEs?

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • This was removed by the editor as SPAM

Viewing 8 posts - 1 through 7 (of 7 total)

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