• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 852
  • Last Modified:

Table naming convention in Adventure Works DataBase in SQL Server 2005

I have noticed that some tables in the Adventure Works DataBase in SQL Server 2005 are named as dbo.[TableName] and some are named as
Person.Address,
Person.Contact,
Person.ContactType etc etc

How can i create a table along these lines.. i.e Person.[tableName] rather than dbo.[TableName]
when i try creating a table and naming it as Person.ContactDetails it does'nt do it.. Instead it creates a table as dbo.Person.ContactDetails..

when i see the properties of the these tables (Person.Address, Person.Contact, Person.ContactType ) i notice that the table Schema is declared as 'Person' what does table schema mean?


Any Suggessions??

COllin
0
Collindsouza
Asked:
Collindsouza
4 Solutions
 
riaancorneliusCommented:
dbo is the db owner. Use sp_changedbowner to change it
0
 
Racim BOUDJAKDJIDatabase Architect - Dba - Data ScientistCommented:
a schema is a logical group of entities represented as tables.  In SQL Server, schema are the logical couterpart of databases.
0
 
riaancorneliusCommented:
example:
exec sp_changedbowner 'Person'
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
CollindsouzaAuthor Commented:
Thank you so much for your Quick reply...

Just a couple more things...

Does it mean that in Adventure Works DataBase the Database Owner(dbo) is changed from its Default i.e dbo to Person.

So How does that help ?? I mean what benefits does it gain to change the dbo to someone else within the same Database
0
 
imran_fastCommented:
>> I mean what benefits does it gain to change the dbo to someone else within the same Database

Multiple tables with the same name in the same databases but haing different schema.
0
 
riaancorneliusCommented:
>> Multiple tables with the same name in the same databases but haing different schema.
Exactly, It might also be clearer if you group different tables together in this way. No real benefits in my opinion though.
0
 
imran_fastCommented:
second thing should create table like this

CREATE TABLE [person].[Table_1]


instead of

CREATE TABLE person.Table_1
0
 
ptjcbCommented:
I use the CREATE SCHEMA, ALTER SCHEMA instead of changedbowner.

For example, I create the schema

CREATE SCHEMA (whatever) AUTHORIZATION dbo;

When I create the table I use either the CREATE TABLE script, and change the schema and table name or

ALTER SCHEMA (whatever) TRANSFER dbo.tablename
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now