Re: How many objects are owned by schema

Tech-Archive recommends: Speed Up your PC by fixing your registry



Hi Tibor,

That is exactly what I meant.
You interpreted my question correctly.
I'll try to use the correct terminology next time.

however, one of the point you seem to make is

An object is also owned by a user (most often the same user as the one who owns the schema the object is in).

I actually thought that all objects belonged to schemas in 2k5/8.
in what circumstances would an object belong to a user - how would you do this.

cheers

martin.


"Tibor Karaszi" <tibor_please.no.email_karaszi@xxxxxxxxxxxxxxxxxx> wrote in message news:O79#h6JzJHA.480@xxxxxxxxxxxxxxxxxxxxxxx
Martin,

Something doesn't add up here. An object is in a schema. A schema is owned by a user. An object is also owned by a user (most often the same user as the one who owns the schema the object is in). But an object is not owned by a schema. Perhaps you meant to identify what objects *are* in a schema? That would be a simple join between sys.objects and sys.schemas (using the schema_id column).

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi


"Martin" <martin_remove_this_@xxxxxxxxxxxxx> wrote in message news:3B8EA770-667D-45E9-ABD9-07F64063DBFE@xxxxxxxxxxxxxxxx
hi,

I am looking to identify objects that are owned by a schema.
Is there a way of querying this from the system tables at all.
I'd prefer to do this via a query rather than looking through SSMS.

I managed to write a query to get the owner

select * from sys.schemas
join sys.sysusers
ON sys.schemas.name = sys.sysusers.name
where sys.schemas.principal_id between 5 and 16383;

I guess that I need to join this onto another table - maybe sysobjects - but I am not sure.

any help appreciated

cheers

martin.




.



Relevant Pages

  • Re: Unkown LDAP query
    ... Something is definitely trying to lookup lots of schema objects. ... Co-author of "The .NET Developer's Guide to Directory Services Programming" ... The only reason I suspect it is the query is because it looks like ... queries that are almost identical. ...
    (microsoft.public.windows.server.active_directory)
  • Re: schema.ini files
    ... I am trying to use the make-table query to export the schema to a file. ... FROM 'GL Transactions'; ...
    (microsoft.public.access.externaldata)
  • Re: Placing Query By Design Grid On Form
    ... Have you never heard of normalizing and normal form 1? ... If your schema is "dynamically" changing, this is an indication of a pretty ... what you still need is some kind of "Query by Form." ... design of the database first. ...
    (microsoft.public.access.formscoding)
  • Re: sqlce & "The column name cannot be resolved to a table"
    ... I'll try and put the schema together. ... > the syntax of your query is causing the error. ... >> think it's the database I think its sqlce. ... Specify the table to which the column belongs". ...
    (microsoft.public.sqlserver.ce)
  • Re: Possible Relationships Design Problem
    ... For example, if you count the rows in your query, you'll see that there ... of clothing, it will have add several lines to the query. ... It would be wonderful to throw and entire schema at Access and have it ... draw up an intelligent interface, but I'm afraid even Bill Gates ain't ...
    (microsoft.public.access.tablesdbdesign)