Grant permission to only a view

喜欢而已 提交于 2019-12-07 14:29:38

问题


I have one user in my database, and I want to grant to him permission to read only one view, nothing more, no tables, nothing.

How can I do this?

Thanks a lot.

P.S.: I am using MS SQL Server 2005


回答1:


USE DB1;
GRANT SELECT ON OBJECT:: View1 TO JohnDoe;
GO

Refer to GRANT Object Permissions for other examples of granting permission




回答2:


Try this:

GRANT SELECT ON whatever_your_view_is_called TO bob_or_whatever_his_name_is



回答3:


This is fairly simple to do with the Enterprise Manager UI or using the SQL code posted by a few others.

One thing I'd like to add is that you want to AVOID doling out rights to the Public role on any object that you might want to later lock down because there every new user you add will automatically be a member of this role.



来源:https://stackoverflow.com/questions/760793/grant-permission-to-only-a-view

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!