Welcome to dbFreaks.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

SSMS 2008: Object Explorer Details

 
   Database Help (Home) -> Tools RSS
Next:  splitting text and updating another table  
Author Message
Toni

External


Since: Aug 19, 2008
Posts: 11



(Msg. 1) Posted: Thu Dec 18, 2008 5:59 am
Post subject: SSMS 2008: Object Explorer Details
Archived from groups: microsoft>public>sqlserver>tools (more info?)

I'm using SQL Server 2008 SSMS against a SQL 2008 database and have a
question about permissions.

As a test, I gave a sql authenticated id Select permissions to two of
the tables. Since that id has access to the tables, shouldn't I be able
to see them when I open SSMS 2008 connected as the test user, expand the
database and then expand Tables?

I can open a New Query window and query the tables and get data returned
without error.

I don't need to be able to see all the objects -- just what I have
access to. Is that possible?

thank you,

Toni

*** Sent via Developersdex http://www.developersdex.com ***

 >> Stay informed about: SSMS 2008: Object Explorer Details 
Back to top
Login to vote
Erland Sommarskog2

External


Since: May 30, 2004
Posts: 2061



(Msg. 2) Posted: Thu Dec 18, 2008 2:56 pm
Post subject: Re: SSMS 2008: Object Explorer Details [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Toni (teibner@allinadotcom) writes:
> I'm using SQL Server 2008 SSMS against a SQL 2008 database and have a
> question about permissions.
>
> As a test, I gave a sql authenticated id Select permissions to two of
> the tables. Since that id has access to the tables, shouldn't I be able
> to see them when I open SSMS 2008 connected as the test user, expand the
> database and then expand Tables?
>
> I can open a New Query window and query the tables and get data returned
> without error.
>
> I don't need to be able to see all the objects -- just what I have
> access to. Is that possible?

That is indeed possible, although it is not default. To see the defintion
of an object, you need the permission VIEW DEFINITION on it. But if you
have SELECT permission, VIEW DEFINITION is implied. However, you can
explicitly deny a user VIEW DEFINITION, in which case the user cannot
see the table in Object Explorer.

The script below illustrates:



CREATE DATABASE tomtefrid
CREATE LOGIN kalleanka WITH PASSWORD='Bengt Feldreich'
go
USE tomtefrid
go
CREATE TABLE nisse (a int NOT NULL)
CREATE TABLE staffan (a int NOT NULL)
CREATE TABLE josef (a int NOT NULL)
CREATE USER kalleanka
go
GRANT SELECT ON nisse TO kalleanka
GRANT SELECT ON staffan TO kalleanka
go
EXECUTE AS LOGIN = 'kalleanka'
go
-- Lists both tables
SELECT object_name(object_id) FROM sys.tables
go
REVERT
go
DENY VIEW DEFINITION ON nisse TO kalleanka
go
EXECUTE AS LOGIN = 'kalleanka'
go
-- Lists only staffan
SELECT object_name(object_id) FROM sys.tables
-- But user can still SELECT.
SELECT a FROM nisse
go
REVERT
go
USE tempdb
go
DROP DATABASE tomtefrid
DROP LOGIN kalleanka


--
Erland Sommarskog, SQL Server MVP, esquel.RemoveThis@sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

 >> Stay informed about: SSMS 2008: Object Explorer Details 
Back to top
Login to vote
Toni

External


Since: Aug 19, 2008
Posts: 11



(Msg. 3) Posted: Fri Dec 19, 2008 5:42 am
Post subject: Re: SSMS 2008: Object Explorer Details [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Erland,

Thank you for your reply.

Unless I am misunderstanding you, this user id should be able to expand
Tables in SSMS and see two tables. It doesn't. The ID hasn't been
denied anything. It has only been granted Select on two tables.

I granted the user id View Definitiion on those two objects and still
don't see the tables listed in SSMS.

If I give the user id View Definition on the database it can see all
objects in the database regardless of whether it has permission to
access the data or not. I'd like the id to only see those two tables
that it has access to.

Is that possible? What am I missing?
Toni

*** Sent via Developersdex http://www.developersdex.com ***
 >> Stay informed about: SSMS 2008: Object Explorer Details 
Back to top
Login to vote
Erland Sommarskog2

External


Since: May 30, 2004
Posts: 2061



(Msg. 4) Posted: Fri Dec 19, 2008 3:24 pm
Post subject: Re: SSMS 2008: Object Explorer Details [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Toni (teibner@allinadotcom) writes:
> Unless I am misunderstanding you, this user id should be able to expand
> Tables in SSMS and see two tables.

That's correct.

> It doesn't. The ID hasn't been
> denied anything. It has only been granted Select on two tables.

But it could be member of a group, for instance public, that you have
denied permission some time in the past and forgotten about.

> I granted the user id View Definitiion on those two objects and still
> don't see the tables listed in SSMS.

Since DENY always takes precendence, that would not be surprising.

> If I give the user id View Definition on the database it can see all
> objects in the database regardless of whether it has permission to
> access the data or not. I'd like the id to only see those two tables
> that it has access to.

Hm, that would prove my theory wrong.

> Is that possible?

Obviously it is possible. Did you try the script that I posted? I suggest
that you play with that script and see what you are able to achieve.
You could run only part of it, and then verify that that the login
kalleanka can see the tables nisse and staffan, but not josef.


--
Erland Sommarskog, SQL Server MVP, esquel DeleteThis @sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
 >> Stay informed about: SSMS 2008: Object Explorer Details 
Back to top
Login to vote
Toni

External


Since: Aug 19, 2008
Posts: 11



(Msg. 5) Posted: Wed Dec 24, 2008 8:38 am
Post subject: Re: SSMS 2008: Object Explorer Details [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

It was after testing with that and not having an issue that I figured
out my problem was really with the objects that were in schemas other
than dbo.

All of the schemas were owned by the user id that created them rather
than being owned by dbo. I changed them to dbo and was able to grant
the permissions needed. I can now see the objects in SSMS without a
problem.

Thank you for your help and for including your script.
Toni

*** Sent via Developersdex http://www.developersdex.com ***
 >> Stay informed about: SSMS 2008: Object Explorer Details 
Back to top
Login to vote
Erland Sommarskog2

External


Since: May 30, 2004
Posts: 2061



(Msg. 6) Posted: Wed Dec 24, 2008 3:28 pm
Post subject: Re: SSMS 2008: Object Explorer Details [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Toni (teibner@allinadotcom) writes:
> It was after testing with that and not having an issue that I figured
> out my problem was really with the objects that were in schemas other
> than dbo.
>
> All of the schemas were owned by the user id that created them rather
> than being owned by dbo. I changed them to dbo and was able to grant
> the permissions needed. I can now see the objects in SSMS without a
> problem.
>
> Thank you for your help and for including your script.

Glad to hear that it worked out.

....and for the future, recall to include such details that objects are
different schemas with different owners. It's easier to help when I
have the full knowledge of what is going on.

--
Erland Sommarskog, SQL Server MVP, esquel.TakeThisOut@sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
 >> Stay informed about: SSMS 2008: Object Explorer Details 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Replace SSMS 2005 with SSMS 2008 - Are there any problems or issues in replacing just SSMS 2005 with the new version - I'd like to get familiar with it, but we have not yet upgraded our databases to 2008 (they are, except for 2, 2005). I'm hoping to do this only on my client/dev system...

[Sql Server 2008 RCO]Where is SSMS ? -

SSMS 2008 - Error on registered server list - Hi, I 've just installed SS 2008 Developer Edition in my machine. It is running side by side with a SS 2005 Developer Edition. After installed (the setup worked fine without problems) I got the following error when I tried to connect to a server: ....

SSMS can't connect across LAN - I'm trying to connect across a LAN to a SQL 2005 server, but it fails with error 233, suggesting that the remote server may not allow remote connections. (Named Pipes Provider). I've checked the settings on the other database server (server properties...

SSMS 2005 - Value does not fall within the expected range... - Help, in SSMS 2005 I get the following error when I try to view the securables on the Database Role Propery dialog. If I click the Add button and on the Add Objects popup dialog select "Add all object belonging to the schema..." then select ...
   Database Help (Home) -> Tools All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]