Solved

SQL Server sys.objects not showing Schemas

Posted on 2012-03-22
6
243 Views
Last Modified: 2012-06-27
Hi,

I was always under the impression that "select * from sys.objects" should return every object in the database, but I am finding it is only returning objects under the main dbo schema.  There are three other schemas in the database, which show up when you query sys.schemas, but they are just missing from the main objects list.  I have tried various INFORMATION_SCHEMA items (tables, procedures, views etc) too, but the same thing is happening.

I am logged in as a user with full access to all the schemas (has equivalent sa rights), so I don't think it's permissions.

What am I missing?  Presumably there must be a way to return every single object in the database, regardless of the schema? (this is for a report, so I need to include everything).

Many thanks!
0
Comment
Question by:itfocus
  • 3
  • 3
6 Comments
 
LVL 69

Expert Comment

by:Scott Pletcher
ID: 37752814
Sure sounds like a potential permissions issue.

If the object is schema-scoped, it should show up in sys.objects.

Does the login have actual server-level "sysadmin"authority?  If so, it's not a permissions issue, and something else is going on.
0
 

Author Comment

by:itfocus
ID: 37752945
I have just double-checked, and the user does indeed have sysadmin authority.  I added serveradmin authority as well, just to see if that made a difference.  I am now seeing the dbo and the sys objects, but again, not the custom-created ones.  I had a look at one of the schemas, to see if I had to set permissions to this user specifically, but it didn't make any difference.

I reran "select * from sys.schemas" but actually looking at it again, none of the custom schemas are listed here either.  all the db_*** ones are, but my user-created ones are not.  Am I just looking in the wrong place?
0
 
LVL 69

Expert Comment

by:Scott Pletcher
ID: 37753220
Yeah, make sure you're in the right db.

And that the other names aren't synonyms or some other name that would not be in that db's sys.objects table -- although the synonyms themselves should be in sys.objects I think.
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
LVL 69

Expert Comment

by:Scott Pletcher
ID: 37753245
Maybe you created the other schemas in another db by accident?

Otherwise this just makes no sense.
0
 

Accepted Solution

by:
itfocus earned 0 total points
ID: 37809823
Hi,

All the schemas were on the right DB and everything; I think it may have been something weird in the setup of the database though (it's an old, test one).  I tried the same thing on a couple of others, and it works ok, so will just chalk it up to random weirdness and move on.

Thanks for the feedback though.
0
 

Author Closing Comment

by:itfocus
ID: 37822814
My own comment upon closing the question.
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how the fundamental information of how to create a table.

809 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