Tuesday, March 1, 2011

Introduction to SQL Server Schemas

Schemas


A schema is nothing more than a named, logical container in which you can create database objects.

A schema is a collection of database objects that is owned by a single person and forms a single namespace.

As of SQL Server 2005 and 2008, users are separated from direct ownership of a database object (such as tables, views, and stored procedures). This separation is achieved by the use of schemas, which are basically containers for database objects. Instead of having a direct object owner, the object is contained within a schema, and that schema is then owned by a user.

One or more users can own a schema or use it as their default schema for creating objects.

CREATE SCHEMA

CREATE SCHEMA schema_name [AUTHORIZATION owner_name ]

Schema name is the name for schema and owner name is database user name.

Eg:

CREATE SCHEMA Teacher 


AUTHORIZATION teacher



CREATE SCHEMA Student

AUTHORIZATION student



1 comment:

Benivolent said...

This is a great list and gives everybody something to think about
Read your article and find more ideas that I will start to work on hope to work with me...


.Net application development