T-SQL Tutorial

T-SQL Create Schema

This article describes how to define a new schema in SQL Server database.
The T-SQL statement CREATE SCHEMA defines schema in the current database.
The CREATE SCHEMA transaction can create objects within the new schema, and set GRANT, DENY, or REVOKE permissions.

Create Schema syntax

CREATE SCHEMA schema_name;
CREATE SCHEMA schema_name AUTHORIZATION [user_name];

Create Schema example

CREATE USER test_user FOR LOGIN [DomainName\WindowsUser];
CREATE SCHEMA test_schema
CREATE TABLE test_table (id int, name varchar(100))
GRANT SELECT ON SCHEMA::test_schema TO test_user
DENY SELECT ON SCHEMA::test_schema TO test_user