views:

120

answers:

3

Hello,

It's my impression that schemas are mainly for organizing the tables, view, stored procedures, etc... in a SQL Server database. Do schemas play a bigger role (perhaps in database security, storage, etc)?

Some clarification: I'm referring to "object" schemas. Sorry for the confusion.

Thank you.

A: 

From an OO perspective, a database schema could be thought of as a class; with the database itself representing an object instance of that class.

The same implications apply from this analogy (re: security, memory use, etc)

Janie
He's referring specifically to the SCHEMA construct in SQL Server as opposed to what one might generally refer to the database schema meaning the table descriptions and constraints.
Cade Roux
I would think a SQL Server Database Object Schemas is more analogous to a Namespace in OO.
jvanderh
I heartily prefer to keep OO as far away from SQL as possible, thank you.
Eric
+3  A: 

Hi

Check this link http://technet.microsoft.com/en-us/library/dd283095.aspx. It covers security aspects under the section 'Using Schemas in SQL Server'.

cheers

Andriyev
Ok. I wasn't the only one understanding the question differently. My bet this is what the question is getting at.
jvanderh
Security is certainly an aspect of it, however having a logical way to organize the objects within a datbase is another. I've worked on many projects with thousands of objects (procs, tables, views) and having them organized into schemas has always made life easier.
Nissan Fan
+3  A: 

Schemas allow you to group your tables for security and/or conceptual sanity. The group could be a department, a specific area of an application, Active Directory group, db role, etc.

If you have a group of tables that only your HR security group needs access to you can create them under the HR schema and enforce the priviledges from there.

If you have an application you might want to create schemas for Sales, Content, and Products just to separate the parts of the application.

dr