SQL Server Role Security Error

Goal:  I want to give users "select" access to a schema via a role.  The schema will have views based on source tables, but I do not want the users to have access to the source tables.

Steps I've performed so far...
1.  Created the role and gave "select" access to the schema
2.  Added users to the role
3.  Created a view, within the schema, from a source table

Error:
When user tries to select from the view, they get an error because they do not have "select" access to the source.

How would I fix?
rickAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

Vitor MontalvãoMSSQL Senior EngineerCommented:
You'll need to give SELECT permissions to the users on the required tables.
Views respect the ownership chaining, meaning that if user is owner of a table, he doesn't need to have permissions on the View that access the table as SQL engine will know it immediately. The same applies if a user doesn't have any permission on the tables that are part of a View. This is how the Security Layer works for Views. If you want to know more about it, please read my articles about Views here in EE:
https://www.experts-exchange.com/articles/16399/Understanding-the-Views-scope-i-Limiting-the-access-to-data.html
https://www.experts-exchange.com/articles/16580/Understanding-the-Views-scope-ii-Ownership-chaining.html
https://www.experts-exchange.com/articles/17019/Understanding-the-Views-scope-iii-The-complete-security-layer.html
0

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
rickAuthor Commented:
Great articles.  Ready all 3.  Very applicable to what I'm doing.

But I am still slightly confused.  In particular, on the following two items

To avoid these situations we can create a View and give permissions only to that View instead of the Table.
You'll need to give SELECT permissions to the users on the required tables.

In my head (or lack of understanding), I'm seeing a contradiction.  I don't want to give users access to the underlying tables; rather, if possible, I only want access to the view.

If not too much trouble, could you try to bridge the gap for me?
0
rickAuthor Commented:
I think I got it now.  I had a few things set up incorrectly.  Thank you so much for your help.  And your articles were great.
1
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

From novice to tech pro — start learning today.