how can i avoid a column in a table from getting deleted?

  • how can i avoid a column in a table from getting deleted.

    I have an important column in a database table. I dont want any user to delete it. how can i give protection to it?

  • Do you mean delete data from the column? You don't mean the end-users of the app have DDL privileges?

    Assuming you want to protect the column... Only allow the users access through a stored procedure or a view and never, ever, allow them to edit the column.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Grant Fritchey (5/27/2008)


    Do you mean delete data from the column? You don't mean the end-users of the app have DDL privileges?

    Assuming you want to protect the column... Only allow the users access through a stored procedure or a view and never, ever, allow them to edit the column.

    Along the same lines as what Grant is talking about (prevent data updates to a specific column): set up a BEFORE UPDATE trigger, that "removes" any updates to that column. Whether it just rolls back all changes in an operation if that column is to be updated, or if it allows all of the other columns to be updated is a matter of implementation.

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

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

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