Bagikan melalui


How to: Create a Database Schema

This topic shows how to create a schema. For information about how to use schemas, see User-Schema Separation.

To create a schema by using SQL Server Management Studio

  1. In SQL Server Management Studio, open Object Explorer and expand the Databases folder.

  2. Expand the database in which to create the new database schema.

  3. Right-click the Security folder, point to New, and then click Schema.

  4. On the General page, enter a name for the new schema in the Schema name box.

  5. In the Schema owner box, enter the name of a database user or role to own the schema.

  6. Click OK.

To create a schema by using Transact-SQL

  1. In Query Editor, connect to the database in which to create the new database schema by executing the following Transact-SQL command:

    USE <database name>
    GO
    
  2. Create the user by executing the following Transact-SQL command:

    CREATE SCHEMA <new schema name> AUTHORIZATION [new schema owner] ; GO