SQL Server - Schema

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

Powered by ComboStrap