rpf
rpf

Reputation: 3712

Grant permission to only a view

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

Upvotes: 3

Views: 27101

Answers (3)

JohnFx
JohnFx

Reputation: 34909

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.

Upvotes: 0

TStamper
TStamper

Reputation: 30364

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

Refer to GRANT Object Permissions for other examples of granting permission

Upvotes: 7

Thomas Padron-McCarthy
Thomas Padron-McCarthy

Reputation: 27632

Try this:

GRANT SELECT ON whatever_your_view_is_called TO bob_or_whatever_his_name_is

Upvotes: 2

Related Questions