开发者

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

开发者 https://www.devze.com 2022-12-28 05:56 出处:网络
While working with some random sql queries on our databases, we may not want to insert or delete items to some of the database tables by just typing their names by mistake. So how to make them locked

While working with some random sql queries on our databases, we may not want to insert or delete items to some of the database tables by just typing their names by mistake. So how to make them locked to the "editing", to be able to work saf开发者_如何学Goe.

Thanks.


Why not just define a role in your database and give that role rights to whatever tables your users need, but this role would not have update/delete rights to the tables you are concerned with?


As the others have mentioned, this should be set up in the Roles.

Here is a useful link on Understanding Roles in SQL Server 2000


Work with a limited-rights account, and deny it rights to modify the 'protected' tables.


Roles are the best practice way to go. However if you can't/won't use roles, you could use triggers, see this answer: SQL Server Query Editors - any that warn of number of rows to be changed?


Move these special tables to its own database. Give the user account only select privileges for this database.

0

精彩评论

暂无评论...
验证码 换一张
取 消