How to Create a Database Schema in MS SQL?

In a database, the schema is the structure that defines the organization of data. It describes the database objects, such as tables, views, stored procedures, indexes, triggers, and functions, and how they relate to one another. Here I want to show steps on how to create DB Schema in MS SQL using the Microsoft SQL Server Management Studio. And in the end, you can check the SQL statement to do the same.

Step 1 – Navigate to Schemas

Create Schema MS SQL

Using the Object Explorer navigate to MyDatabase -> Security -> Schemas -> New Schema

Step 2 – Set Schema Name and Owner

In the ‘Scheme – New’ dialog you need to set the ‘Schema name’ and ‘Schema owner’. In our case I typed ‘persons’ and by clicking the ‘Search…’ button I set ‘dbo’(default) user as an owner. Don’t forget to click on ‘Check Names’ to pick the correct user.
Set Schema Name and Owner

Result:
created schema result

Create Schema Using the SQL Command

Here is the second way to create a schema. In the query window use the following statement:

CREATE SCHEMA [schema_name] AUTHORIZATION [owner_name]

For our example it would be:

USE [YarkulTestDb1]
GO
CREATE SCHEMA [person] AUTHORIZATION [dbo]

 

create MS SQL Schema using the SQL construction Create Schema

Leave a Comment