Datasheet

Chapter 1: Being Objective: Re-Examining Objects in SQL Server
A database is typically a group that includes at least a set of table objects and, more often than not, other
objects, such as stored procedures and views that pertain to the data stored in the database’s tables.
When you first load SQL Server, you will start with four system databases:
master
model
msdb
tempdb
All of these need to be installed for your server to run properly. (Indeed, for some of them, it won’t run at
all without them.) From there, things vary depending on which installation choices you made. Examples
of some of the databases you may also see include the following:
AdventureWorks or AdventureWorks2008 (the sample databases downloadable from
codeplex.com
)
AdventureWorksLT or AdventureWorksLT2008 (a ‘‘lite’’ version of the main sample database)
AdventureWorksDW or AdventureWorksDW2008 (sample for use with Analysis Services)
In addition to the primary examples supported by Microsoft, you may, when searching the Web or using
other tutorials, find reference to a couple of older samples:
pubs
Northwind
The master Database
Every SQL Server, regardless of version or custom modifications, has the master database. This database
holds a special set of tables (system tables) that keeps track of the system as a whole. For example,
when you create a new database on the server, an entry is placed in the
sysdatabases
table in the
master database (though, if you’re interested in data from
sysdatabases
, you should only access it
via the
sys.databases
metadata view). All extended and system stored procedures, regardless of which
database they are intended for use with, are stored in this database. Obviously, since almost everything
that describes your server is stored in here, this database is critical to your system and cannot be deleted.
The system tables, including those found in the master database, can, in a pinch, be extremely useful.
That said, their direct use is diminishing in importance as Microsoft continues to give more and more
other options for getting at system level information.
I used t o be a significant user of system tables; that is no longer the case.
Microsoft has recommended against using the system tables since prior to version
7.0 (1998 or so?). They make absolutely no guarantees about compatibility in the
master database between versions indeed, they virtually guarantee that they will
3