防止对某些表执行 SQL Server 表操作(INSERT 和 DELETE)

发布于 2024-08-30 23:29:20 字数 98 浏览 1 评论 0原文

在我们的数据库上处理一些随机 SQL 查询时,我们可能不希望通过错误地输入项目名称来向某些数据库表插入或删除项目。那么如何让他们锁定“编辑”,才能够安全工作。

谢谢。

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 safe.

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

爱情眠于流年 2024-09-06 23:29:20

为什么不在数据库中定义一个角色,并为该角色授予用户所需的任何表的权限,但该角色没有对您关心的表的更新/删除权限?

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?

凉墨 2024-09-06 23:29:20

正如其他人提到的,这应该在角色中设置。

这是 了解 SQL Server 2000 中的角色

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

朕就是辣么酷 2024-09-06 23:29:20

使用权限有限的帐户,并拒绝其修改“受保护”表的权利。

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

梦毁影碎の 2024-09-06 23:29:20

角色是最佳实践方式。但是,如果您不能/不会使用角色,则可以使用触发器,请参阅此答案:SQL Server 查询编辑器 - 是否警告要更改的行数?

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?

萌辣 2024-09-06 23:29:20

将这些特殊表移至其自己的数据库中。仅授予用户帐户对此数据库的选择权限。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文