Dela via


Schemas (Database Engine)

A schema is a container that holds tables, views, procedures, and so on. It is inside a database, which is inside a server. These entities fit together like nested boxes. The server is the outermost box, and the schema is the innermost box. It holds all of the securables listed below. But it cannot hold another box.

Securable that must be inside a schema

Class

Type

TYPE

XML Schema Collection

XML SCHEMA COLLECTION

Table

OBJECT

View

OBJECT

Procedure

OBJECT

Function

OBJECT

Aggregate

OBJECT

Constraint

OBJECT

Synonym

OBJECT

Queue

OBJECT

Statistic

OBJECT

Every securable in a specific schema must have a unique name. The fully-specified name of a securable contained by a schema includes the name of the schema that contains it. Thus, a schema is also a namespace.

Note

In SQL Server 2000 and earlier versions, databases could contain an entity called a "schema", but that entity was effectively a database user. In SQL Server 2005 and SQL Server 2008, a schema is both a container and a namespace.