• Status: Solved
  • Priority: Low
  • Security: Public
  • Views: 25
  • Last Modified:

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

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?
  • 2
1 Solution
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:
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?
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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now