?
Solved

Table naming convention in Adventure Works DataBase in SQL Server 2005

Posted on 2006-07-10
8
Medium Priority
?
804 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 1000 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 200 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
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

 
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 400 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 400 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Suggested Courses

771 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