Results 1 to 6 of 6

Thread: [RESOLVED] MS SQL 2005 Schema Usage

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2008
    Location
    Portland, OR, USA
    Posts
    659

    Resolved [RESOLVED] MS SQL 2005 Schema Usage

    Hi All-

    I am curious about "schema" ini MS SQL Server 2005.

    Would it be a correct usage to create "schemas" for the purpose of organizing database objects, if there were a valid reason for doing so, or am I missing something?

    For example, if I wanted a means of separating my user-created sprocs from others, (or even sub-classing my user sprocs by function), would this be a "correct" useage of schemas in SQL Server?

  2. #2
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: MS SQL 2005 Schema Usage

    I don't think I would do that. I would use schemas for seperation of data only. If more then one person is using the database with tables named the same.
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2008
    Location
    Portland, OR, USA
    Posts
    659

    Re: MS SQL 2005 Schema Usage

    SO the schema is used to say, distinguish between database objects with the same name?

    i.e.

    dbo.tblContracts
    sec.tblContracts

    Etc?
    assuming these are two unique tables, with different data in each, but have been named the same?

  4. #4
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: MS SQL 2005 Schema Usage

    Yes.... It can also be used if you are segregating data in tables with out the same name. I just don't normally do that.

    Be careful also.... In Oracle the schema is based on a user name. When a user connects to an Oracle database they are placed in their own schema by default. They do not have access to any other schema unless specifically granted that right.

    So Oracle and SQL Server both have schema objects but they are used somewhat differently.
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  5. #5
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: MS SQL 2005 Schema Usage

    Schema's changed a real lot in MS SQL 2005

    http://msdn.microsoft.com/en-us/library/ms190387.aspx

    But to answer your original question - yes - they can be used for organizing

    Look at this link

    http://searchsqlserver.techtarget.co...184503,00.html

    This talks about using schema's for organizing objects.
    Attached Images Attached Images  

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  6. #6
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    Re: [RESOLVED] MS SQL 2005 Schema Usage

    Just bear in mind that you will incur name resolution overhead especially for functions/stored procedures if you segregate them into too many schema.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width