开发者

How to grant select rights on views in SQL Server 2000?

I have a user who I want to give readonly access to开发者_运维技巧 an SQL Server 2000 database. I have put them in the db_datareader role, and they can select from tables fine, but when they attempt to select from a view, 0 rows are always returned (the view does return rows when run as db_owner).

How can I grant this user access to read views while still ensuring they can't write to the database?


GRANT SELECT ON [viewname] TO [user or role_name]

should propagate to all objects that are referenced in the view


They have permissions on the view if they get zero rows. They'd get an error if they had no rights.

Some code in the view is filtering, such as this quick example:

WHERE SUSER_SNAME() = 'dbo' 

db_datareader on MSDN, my bold. For SQL Server 2005.

Members of the db_datareader fixed database role can run a SELECT statement against any table or view in the database.

For SQL Server 2000, it says "Reads all data from all user tables." which is slightly different. I always thought it meant tables and views but I don't have a SQL Server 2000 box to check

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜