Solved

Table naming convention in Adventure Works DataBase in SQL Server 2005

Posted on 2006-07-10
8
786 Views
Last Modified: 2012-06-22
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
Comment
Question by:Collindsouza
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 9

Accepted Solution

by:
riaancornelius earned 250 total points
ID: 17071411
dbo is the db owner. Use sp_changedbowner to change it
0
 
LVL 23

Assisted Solution

by:Racim BOUDJAKDJI
Racim BOUDJAKDJI earned 50 total points
ID: 17071413
a schema is a logical group of entities represented as tables.  In SQL Server, schema are the logical couterpart of databases.
0
 
LVL 9

Expert Comment

by:riaancornelius
ID: 17071414
example:
exec sp_changedbowner 'Person'
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
LVL 5

Author Comment

by:Collindsouza
ID: 17071461
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
 
LVL 28

Assisted Solution

by:imran_fast
imran_fast earned 100 total points
ID: 17071469
>> 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
 
LVL 9

Expert Comment

by:riaancornelius
ID: 17071476
>> 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
 
LVL 28

Expert Comment

by:imran_fast
ID: 17071480
second thing should create table like this

CREATE TABLE [person].[Table_1]


instead of

CREATE TABLE person.Table_1
0
 
LVL 27

Assisted Solution

by:ptjcb
ptjcb earned 100 total points
ID: 17072499
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

Featured Post

Backup Solution for AWS

Read about how CloudBerry Backup fully integrates your backups with Amazon S3 and Amazon Glacier to provide military-grade encryption and dramatically cut storage costs on any platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how the fundamental information of how to create a table.

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question