views:

41

answers:

3

what is the difference between creating ordinary tables using 'dbo' and creating tables using schemas.How this schema works & supports the tables

+3  A: 

dbo is a schema.

John Saunders
+1  A: 

See if this helps.

Schema seems to be a way of categorizing objects (tables/stored procs/views etc).
Think of it as a bucket to organize related objects based on functionality.

I am not sure, how logged in SQL user is tied to a specific schema though.

shahkalpesh
+3  A: 

A schema is just a container for DB objects - tables, views etc. It allows you to structure a very large database solution you might have. As a sample, have a look at the newer AdventureWorks sample databases - they have a number of schemata included, like "HumanResources" and so forth.

A schema can be a security boundary, e.g. you can give or deny certain users access to a schema as a whole. A schema can also be used to keep tables with the same name apart, e.g. you could create a "user schema" for each user of your application, and have a "Settings" table in each of them, holding that user's settings, e.g. "Bob.Settings", "Mary.Settings" etc.

In my experience, schemata are not used very often in SQL Server. It's a way to organize your database objects into containers, but unless you have a huge amount of database objects, it's probably something you won't really use much.

marc_s