开发者

best way to grant read only access to 2 tables in SQL Server 2005?

开发者 https://www.devze.com 2023-02-04 09:45 出处:网络
whats the best way to grant access to a few users to a couple tables in a SQL Server 2005 database? I know the literature pushes the use of views but what is the gain over granting read only access t

whats the best way to grant access to a few users to a couple tables in a SQL Server 2005 database?

I know the literature pushes the use of views but what is the gain over granting read only access to the actual table?

at least with the table there will be less overhead in that the index and other restraints are already in place and managed at the table (a single point of maintenance). If I make views then won't开发者_如何学运维 i need to maintain them and create indexes on them... as well as this will be additional overhead for SQL itself?


CREATE ROLE role_name
GRANT SELECT ON table_name TO role_name

Don't forget to add users to that role. Adding individual permissions is generally a bad practice.

Using views and giving permissions to the view is useful if you want to hide particular columns / name columns in different ways / otherwise filter the data.

0

精彩评论

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

关注公众号