Solved

SQL Server sys.objects not showing Schemas

Posted on 2012-03-22
6
238 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:ScottPletcher
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:ScottPletcher
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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 69

Expert Comment

by:ScottPletcher
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

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

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

746 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

18 Experts available now in Live!

Get 1:1 Help Now