Prevent SQL Server table operations (INSERT and DELETE) on some tables

When working with some random sql queries in our databases, we may not want to insert or delete items into some database tables, just typing their names by mistake. So how do you make them locked for "editing" to be safe.

Thanks.

+2


a source to share


5 answers


Why not just define a role in your database and grant rights to that role for any tables your users need, but that role wouldn't have update / delete rights for the tables you touch?



+2


a source


As mentioned, this needs to be set in Roles.



Here is a helpful link to Understanding Roles in SQL Server 2000

+1


a source


Work with a limited account and prevent it from being modified for "protected" tables.

0


a source


Roles are best practice. However, if you cannot / won't use roles, you can use triggers, see this answer: SQL Server Query Editors - Any warnings about the number of rows to change?

0


a source


Move these special tables to your own database. Grant only privileges to the user account for this database.

0


a source







All Articles