Solved

Table naming convention in Adventure Works DataBase in SQL Server 2005

Posted on 2006-07-10
8
764 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
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
 
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
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

930 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now