What is a Schema in SQL Server 2005? Explain how to create a new Schema in a a Database?

What is a Schema in SQL Server 2005? Explain how to create a new Schema in a a Database.

A Schema can be used in many ways including: maintain a backup script to allow the user to create all users, groups, logins and permissions, to create/modify development code, to create an environment from it for testing. It acts as the container of all object in the database which can be used to recreate the database along with its objects intact. It is synonymous to a namespace.

Syntax:
CREATE SCHEMA schema_name_clause [ <schema_element> [ ...n ] ]
<schema_name_clause> ::=
{
   schema_name
   | AUTHORIZATION owner_name
   | schema_name AUTHORIZATION owner_name
}
<schema_element> ::=
{
   table_definition | view_definition | grant_statement |
   revoke_statement | deny_statement
}

What is a Schema in SQL Server 2005? Explain how to create a new Schema in a a Database.

A schema is used to create database objects. It can be created using CREATE SCHEMA statement. The objects created can be moved between schemas. Multiple database users can share a single default schema.
CREATE SCHEMA sample;
Table creation

Create table sample.sampleinfo
{
  id int primary key,
  name varchar(20)
}
Explain how to create a Scrollable Cursor with the SCROLL Option
Create a Scrollable Cursor with the SCROLL Option - Using the SCROLL keyword while declaring a cursor allows fetching of rows in any sequence.......
Explain how to create a Dynamic Cursor with the DYNAMIC Option
Create a Dynamic Cursor with the DYNAMIC Option - When a cursor is declared as DYNAMIC, the cursor reflects all changes made to the base tables as the cursor is scrolled around......
SQL Server System database - Master,MSDB,TEMPDB,Model
SQL Server System database - Describe in brief system database. You can find answer to this question in this series.
Post your comment