Turn Off Delete

  • Is there anyway I can turn off delete in SQL server? I want to prevent anyone inadvertently deleting rows in tables. I thought worse case I could have triggers on tables to perform roll back, just did not know if there was a better idea?

  • I'm not so sure about this, but you could deny delete on your tables/schema. http://technet.microsoft.com/en-us/library/ms176128.aspx

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • Luis Cazares (6/11/2014)


    I'm not so sure about this, but you could deny delete on your tables/schema. http://technet.microsoft.com/en-us/library/ms176128.aspx

    That's an option, but bear in mind that anyone with sysadmin can still delete as they cannot be denied anything.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • I'd go with the DENY approach and then make sure that only appropriate people have access to the system.

    However, that's not even the scary thing. The scary thing is when someone with administrative rights drops a table, or a database, or runs a restore on the wrong server overwriting the database. All kinds of things can go wrong and there's little you can do to prevent all of them. Best bet is to have a very good backup process in place, test those backups, and practice restores to a point in time.

    "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

Viewing 4 posts - 1 through 4 (of 4 total)

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