Grant read access to SQL Management Server

How to grant a user to have read access to all object in a MS SQL 2008 R2, including the stored procedure created by other ?

Tks
AXISHKAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Haris DulicIT ArchitectCommented:
You can create role for that specific case and then just add remove users from that role, i.e. use this code:

CREATE ROLE NEW_ROLE ;

GRANT EXECUTE SELECT ON SCHEMA::dbo TO NEW_ROLE 

EXEC sp_addrolemember 'NEW_ROLE ', 'NEW_USER'

Open in new window

Vitor MontalvãoMSSQL Senior EngineerCommented:
You can give to an user the db_datareader role permission but this is only to read data (table and views). For stored procedure and functions you need to grant execute permission for each created object.
AXISHKAuthor Commented:
Can we use TSQL to loop through all the user defined SQL Procedure and grant it to a user ? There are over a hundred of procedures ...

Tks
The 7 Worst Nightmares of a Sysadmin

Fear not! To defend your business’ IT systems we’re going to shine a light on the seven most sinister terrors that haunt sysadmins. That way you can be sure there’s nothing in your stack waiting to go bump in the night.

Haris DulicIT ArchitectCommented:
use  GRANT EXECUTE ON SCHEMA::dbo TO USER
AXISHKAuthor Commented:
Tks, in case only need to explicitly grant few stored procedure to a user. How to achieve it ?
Vitor MontalvãoMSSQL Senior EngineerCommented:
You need to run the following command for each SP and user:
GRANT EXECUTE ON StoredProcedureName TO Username

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AXISHKAuthor Commented:
Tks
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.