question

RLM avatar image
RLM asked

Differentiate Schema and Ownership

Both schema and ownership have the same format of schema_name/owner_name.object_name. When I see something like this, how do I know it's a schema or an owership?

sql-server-2005schemaownership
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

TimothyAWiseman avatar image
TimothyAWiseman answered

If it is in SQL Server 2005/2008 then it is Schema.object_name. Now, at time of creation the schema will normally default if no action is taken to the owner's name, but once the object is created the owner name and schema name are separate entities and tracked entirely separately.

If you want to find the objects owner, you have several options, but the easiest is to right click on the object in SSMS and go to properties.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Matt Whitfield avatar image
Matt Whitfield answered

In SQL Server 2000 it's quite simple - everything is the same, because users and schemas are the same thing. The majority of objects are schema-scoped, so it's easy to understand.

In 2005 and 2008, it gets more complex, because a lot more of the objects are spread across differenct scopes. So you have schema-scoped objects, which belong to a schema, database-scoped objects which belong to a database, and server-scoped objects which belong to the server as a whole.

Both schema-scoped and database-scoped objects have owners - thus you can use the ALTER AUTHORIZATION statement to change the owner of an object.

For schema-scoped objects, the default owner is the owner of the schema to which the objects belong.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.