Schemas
Purpose
Section titled “Purpose”Schema refers to a specific database tables and how they are related to each other. It provides an organisational blueprint of how the database is constructed. Additional benefits of implementing database schemas is that schemas can be used as a method restricting / granting access to specific tables within a database.
Creating a Schema
Section titled “Creating a Schema”CREATE SCHEMA dvr AUTHORIZATION Owner CREATE TABLE sat_Sales (source int, cost int, partid int) GRANT SELECT ON SCHEMA :: dvr TO User1 DENY SELECT ON SCHEMA :: dvr to User 2GOAlter Schema
Section titled “Alter Schema”ALTER SCHEMA dvr TRANSFER dbo.tbl_Staging;GOThis would transfer the tbl_Staging table from the dbo schema to the dvr schema
Dropping Schemas
Section titled “Dropping Schemas”DROP SCHEMA dvr