Solved

Table naming convention in Adventure Works DataBase in SQL Server 2005

Posted on 2006-07-10
8
763 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

705 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

13 Experts available now in Live!

Get 1:1 Help Now