How To Create A Schema In SQL Server

As an SQL developer, I was required to create a new schema for the SQL server. I have identified a few simple approaches to this. In this article, I will walk you through each approach individually.

Approach 1: Using the CREATE SCHEMA Statement

This is the basic approach to do this task.

Syntax

CREATE SCHEMA SchemaName;

Example

We can execute the below SQL query to create the schema named USA.

CREATE SCHEMA USA;

After executing the above query, I got the expected output, as shown in the screenshot below.

How To Create A Schema In SQL Server

We can execute the below select query to check if the schema was created successfully.

Select * from sys.schemas;
how to create a new schema in sql server

Check out How To Change Schema Of A Table In SQL Server

Approach 2: Creating Schema with Owner

We can also create the schema with the owner’s name.

Syntax

CREATE SCHEMA SchemaName AUTHORIZATION OwnerName;

Example

We can execute the query below to create a USA schema with the USALead owner.

CREATE SCHEMA USA AUTHORIZATION USALead;

Check out How To Create A Table With Identity Column In SQL Server

Approach 3: Using SQL Server Management Studio (SSMS)

Follow the below steps.

1. Expand the Database name in SSMS.

2. Right-click on the Security folder

create schema sql server

3. Enter the Schema name and then click on the Ok button, as shown in the screenshot below.

create schema sql server management studio

Now, you can see below that the schema was created successfully.

how to create schema in sql server

Conclusion

Creating a schema in an SQL server database is easy using multiple approaches, as mentioned in this article.

You may also like following the articles below.