Re: How many objects are owned by schema
- From: "Martin" <martin_remove_this_@xxxxxxxxxxxxx>
- Date: Tue, 5 May 2009 07:11:50 +1200
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@xxxxxxxxxxxxxxxxhi,
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.
- Follow-Ups:
- Re: How many objects are owned by schema
- From: Tibor Karaszi
- Re: How many objects are owned by schema
- From: Dan Guzman
- Re: How many objects are owned by schema
- References:
- How many objects are owned by schema
- From: Martin
- Re: How many objects are owned by schema
- From: Tibor Karaszi
- How many objects are owned by schema
- Prev by Date: Re: Get ID's from list
- Next by Date: Re: No Cursor Solutions Please
- Previous by thread: Re: How many objects are owned by schema
- Next by thread: Re: How many objects are owned by schema
- Index(es):
Relevant Pages
|