SQL Server - Schema

Card Puncher Data Processing

Management

Owner

The new schema is owned by one of the following database-level principals:

  • database user,
  • database role,
  • or application role.

Objects created within a schema are owned by the owner of the schema. The ownership can be transferred but the schema owner always retains CONTROL permission on objects within the schema.

Create

CREATE SCHEMA schemaName AUTHORIZATION dbo;

Reference

See

SELECT * FROM sys.schemas;

Default

The default schema name can be seen in the principal table.

SELECT * FROM sys.database_principals;

and can be modified for the user

ALTER USER myUser WITH DEFAULT_SCHEMA = myschema
create USER myUser WITH DEFAULT_SCHEMA = myschema





Discover More
Card Puncher Data Processing
SQL Server - Object

Objects created within a schema are owned by the owner of the schema, and have a NULL principal_id in sys.objects. Ownership of schema-contained objects can be transferred to any database-level principal,...



Share this page:
Follow us:
Task Runner