Using SQL Server
In this section, you'll explore some of the tools you use to manage SQL Server.
Specifically, you'll learn how to start and stop SQL Server using the Service Manager and
use the Enterprise Manager to administer SQL Server.
Starting and Stopping SQL Server
To start and stop SQL Server, you use the Service Manager tool. To open the Service
Manager, you select Start ➣ Programs ➣ Microsoft SQL Server ➣ Service Manager.
The Service Manager is shown in Figure 2.1
.
Figure 2.1: The Service Manager
You select the name of the server computer on which SQL Server is running in the Server
drop-down list box. To start SQL Server, you click the Start/Continue button. To stop
SQL Server, you click the Stop button. You can also use the Service Manager to pause
SQL Server, and select whether you want to automatically start SQL Server when the
operating system (OS) starts.
Once you've started SQL Server, other programs can access the databases managed by
that SQL Server installation.
Using Enterprise Manager
To administer a database, you use the Enterprise Manager tool. You can create databases,
create and edit tables, create and edit users, and so on, using Enterprise Manager. To
open the Enterprise Manager, you select Start ➣ Programs ➣ Microsoft SQL Server ➣
Enterprise Manager. The Enterprise Manager is shown in Figure 2.2
.
Figure 2.2: The Enterprise Manager
On the left pane of Enterprise Manager, you'll see a tree that shows the accessible SQL
Server installations. The contents of the right pane of Enterprise Manager display
different information based on what you select in the left pane. For example, I selected
the Databases folder and the North-wind database in the left pane when preparing Figure
The Distributed Transaction Coordinator service allows you to manage
transactions that use more than one database. The Full Text Search service allows
you to perform searches for phrases through large amounts of text. The SQL Mail
service allows you to send electronic mail from SQL Server.
•
Meta Data Services Contains tools that allow you to manage the information
stored in the local repository. This information contains details about databases,
users, tables, columns, views, stored procedures, and so on. This information is
primarily used by data-warehousing applications.
Note Since this is a book on database programming, I won't cover too many details on
database administration; I'll just focus on the Databases folder. Typically, your
organization will have a database administrator, or DBA, who takes care of
administering your databases and will use the other folders to perform their tasks. If
you need more details on administering SQL Server, I recommend the book
Mastering SQL Server 2000 by Mike Gunderloy and Joseph L. Jorden (Sybex,
2000).
Let's take a closer look at the Databases folder, which contains the databases that are
managed by a particular SQL Server installation. For example, my SQL Server
installation manages six databases named master, model, msdb, Northwind, pubs, and
tempdb. When you expand the Databases folder for a database, you'll see the following
nodes:
•
Diagrams You use a diagram to store a visual representation of the tables in a
database. For example, the Northwind database contains many tables, four of
which are named Customers, Orders, Order Details, and Products. Figure 2.3
illustrates how these tables are related. The columns for each table are shown
within each box in the diagram. For example, the Customers table contains 11
columns: CustomerID, CompanyName, ContactName, ContactTitle, Address,
shows the properties
for the alphabetical list of products view. The text of the view is written in SQL,
which you'll learn more about in Chapter 3
, along with how to use the view in that
chapter.
Figure 2.6: The alphabetical list of products view properties
•
Stored Procedures You use a stored procedure to run a sequence of statements in
the database. In SQL Server, stored procedures are written in Transact-SQL,
which you'll learn about in Chapter 4
. Stored procedures are saved in the database,
and are typically used when you need to perform a task that intensively uses the
database, or you want to centralize a function in the database that any user can call