Solved

sql server user restrict to one schema

Posted on 2008-10-02
4
679 Views
Last Modified: 2012-05-05
I have a sql login that i want to restrict to one schema, how can i do that?

for example user1
and
marketing.customers
accounting.customers

I want user1 to only see marketing.customers.  I have many more under the same schema.  I want the user to me able to select from all the tables that exists for this schema.  Is there a script for this?
0
Comment
Question by:yanci1179
  • 3
4 Comments
 
LVL 60

Expert Comment

by:chapmandew
Comment Utility
you can grant the user view definition to the schema you want them to be able to see objects

grant view definition on schema::marketing to username

and to select data

grant select on schema::marketing to username

to resetrict to the other schema

deny select on schema::marketing to username
0
 
LVL 60

Expert Comment

by:chapmandew
Comment Utility
sorry last one should be:

grant select on schema::accounting to username
0
 
LVL 60

Accepted Solution

by:
chapmandew earned 500 total points
Comment Utility
geez....wrong again.  try this:

deny select on schema::accounting to username
0
 
LVL 39

Expert Comment

by:BrandonGalderisi
Comment Utility
grant has a schema option here's the details.

http://msdn.microsoft.com/en-us/library/ms187940.aspx
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now