Beginning SQL Server 2000 for Visual Basic Developers 1st Edition Thearon Willis (Auth.) instant download
Beginning SQL Server 2000 for Visual Basic Developers 1st Edition Thearon Willis (Auth.) instant download
https://ebookgate.com/product/beginning-sql-server-2000-for-
visual-basic-developers-1st-edition-thearon-willis-auth/
https://ebookgate.com/product/beginning-microsoft-visual-
basic-2008-thearon-willis/
ebookgate.com
https://ebookgate.com/product/beginning-sql-server-for-developers-
fourth-edition-robin-dewson/
ebookgate.com
https://ebookgate.com/product/murach-s-sql-server-2012-for-
developers-1st-edition-bryan-syverson/
ebookgate.com
https://ebookgate.com/product/beginning-microsoft-sql-
server-2008-programming-robert-vieira/
ebookgate.com
SQL Server 2000 Stored Procedures Handbook 1st Edition
Tony Bain
https://ebookgate.com/product/sql-server-2000-stored-procedures-
handbook-1st-edition-tony-bain/
ebookgate.com
Pro ASP NET for SQL Server High Performance Data Access
for Web Developers 1st Edition Brennan Stehling
https://ebookgate.com/product/pro-asp-net-for-sql-server-high-
performance-data-access-for-web-developers-1st-edition-brennan-
stehling/
ebookgate.com
https://ebookgate.com/product/beginning-visual-basic-net-
databases-1st-edition-denise-gosnell/
ebookgate.com
https://ebookgate.com/product/sql-server-t-sql-recipes-4th-edition-
jason-brimhall/
ebookgate.com
https://ebookgate.com/product/beginning-jquery-2-for-asp-net-
developers-1st-edition-bipin-joshi/
ebookgate.com
Summary of Contents
Introduction
Chapter 1: Introduction to SOL Server 2000
Chapter 2: Installing the Personal Edition of SOL Server 2000
Chapter 3: Designing and Creating the Development Database
Chapter 4: SOL Server Security
Chapter 5: SWl Server Ouery Analyzer
Chapter 6: Database Connections
Chapter 7: Introduction to Stored Procedures
Chapter 8: Stored Procedures versus SOL Statements
Chapter 9: Selecting Data
Chapter 10: Inserting Data
Chapter 11: Updating Data
Chapter 12: Deleting Data
Chapter 13: Working with Text Data
Chapter 14: Installing Internet Information Server (liS)
Chapter 15: SOL Server and XMl
Chapter 16: XMl Web Reports
Case Study: Part 1- Building an English Ouery Application
Case Study: Part 2- Deploying an English Ouery Application
Appendix A: SOL Server and VB Data Types
Appendix B: ADO 2.6 Object Model
Appendix C: SOL Server Functions
Appendix D: Building the Hardware Tracking Framework
Appendix E: Creating the Hardware Tracking Business Server Component
Appendix F: References
Appendix G: Support, Errata, support.apress.com
Index
Beginning SQL Server 2000 for
Visual Basic Developers
Thearon Willis
Trademarked names may appear in this book. Rather than use a trademark symbol with every
occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit
of the trademark owner, with no intention of infringement of the trademark.
Distributed to the book trade in the United States by Springer-Verlag New York, Inc., 175 Fifth
Avenue, New York, NY, 10010 and outside the United States by Springer-Verlag GmbH & Co. KG,
Tiergartenstr. 17,69112 Heidelberg, Germany.
For information on translations, please contact Apress directly at 2560 Ninth Street, Suite 219,
Berkeley, CA 94710. Phone 510-549-5930, fax 510-549-5939, email info@apress.com, or visit
http://www.apress.com.
The information in this book is distributed on an "as is" basis, without warranty. Although every
precaution has been taken in the preparation of this work, neither the author{s) nor Apress shall have
any liability to any person or entity with respect to any loss or damage caused or alleged to be caused
directly or indirectly by the information contained in this work.
The source code for this book is available to readers at http://www.apress.comin the Downloads
section.
Credits
Cover Figures
Kurt Krames Shabnam Hussain
After learning the BASIC language Thearon moved on to learn COBOL and began writing programs
to help automate some of his daily tasks as a computer operator. Advancing his career, Thearon
became an Operations Analyst and learned several other languages to assist in his job.
In 1989 Thearon moved into Systems Programming and started programming in S370 ASSEMBLER
language. He coded batch programs in ASSEMBLER language and then moved on to code CICS
programs. The Help Desk and Network Operations used these batch and online programs to perform
some of their daily tasks, such as monitoring CICS printers and polling sales. During this time he
started working with relational databases on the mainframe and immediately saw the benefits that
relational databases provided.
Between the years of 1988 and 1993 Thearon learned several more programming languages, which
include QBASIC, PASCAL, and C++. Thearon decided that he enjoyed programming so much that
he switched his career path and became a developer full time.
The first application that Thearon worked on was written in ASSEMBLER language and included
over 70 ASSEMBLER programs. To help automate some of the tasks that were performed by the
department that used this application, he wrote several programs in Visual Basic. One of these
programs read and processed data from message queues that were populated from the mainframe,
and performed automated balancing.
Thearon first began working with Visual Basic in version 3.0. After version 4 was released he
switched his career from the mainframe to client-server development. He still enjoys working with
relational databases and uses SQL Server as the back-end to all of his applications that store and
retrieve data.
Thearon currently works as a senior consultant and develops intranet/Internet and business-to-
business applications. He lives with his wife Margie and daughter Stephanie in Charlotte, North
Carolina.
I would like to thank some ofthe folks at Wrox Press for making this book possible. Thanks go to
Dominic Lowe for getting this project started, to Dianne Parker for her invaluable insight and technical
editing skills, to Ben Egan for his hard work, and to Cilmara Lion for coordinating the work.
I would like to thank my wife Margie for her faith in me and the patience she has shown while I
write one book after another. It is to her and my daughter Stephanie that I dedicate this book.
Beginning SQL Server 2000 for Visual Basic Developers
Trademarked names may appear in this book. Rather than use a trademark symbol with every
occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit
of the trademark owner, with no intention of infringement of the trademark.
For information on translations, please contact Apress directly at 2560 Ninth Street, Suite 219,
Berkeley, CA 94710. Phone 510-549-5930, fax 510-549-5939, email info@apress.com, or visit
http://www.apress.com.
The information in this book is distributed on an "as is" basis, without warranty. Although every
precaution has been taken in the preparation of this work, neither the author{s) nor Apress shall have
any liability to any person or entity with respect to any loss or damage caused or alleged to be caused
directly or indirectly by the information contained in this work.
The source code for this book is available to readers at http://www.apress.comin the Downloads
section.
Table of Contents
Introduction 1
What This Book Is About 1
How This Book Is Organized 2
Who This Book Is For 5
What You Need To Use This Book 5
Conventions 6
Downloading The Source Code 7
TeU Us What You Think 7
Errata & Updates 8
Tools Overview 50
Enterprise Manager 50
Databases 52
Data Transformation Services 53
Management 54
Replication 55
Security 56
Support Services 57
Meta Data Services 57
Query Analyzer 58
SQL Server Profiler 59
Wizards 60
Register SQL Server Wizard 60
Create Database Wizard 60
Create Index Wizard 61
Create Login Wizard 61
Full-Text Indexing Wizard 61
Wizard Summary 61
Summary 62
ii
Table of Contents
Summary 99
iii
Table of Contents
iv
Table of Contents
Summary 249
V
Table of Contents
vi
Table of Contents
vii
Table of Contents
viii
Table of Contents
Index 845
ix
Introduction
Everywhere you look these days Microsoft SQL Server is there. You hear about dotcom companies
running SQL Server and accessing terabytes of data, and applications that need to be scaled up from
Access to use SQL Server. You just can't seem to escape the presence of SQL Server in the workplace.
SQL Server 2000 is the latest release and, because of performance enhancements and new features, this
is a great time to learn how to use SQL Server and how to incorporate it into your applications.
Whether you are building VB applications (front-end or back-end) or web applications, if you need data
access to SQL Server 2000 this book can help. While most of the book covers accessing SQL Server
2000 from VB, the same principles can be applied to Active Server Pages using VBScript and ADO
(Active X Data Objects). This book covers the use of in-line SQL statements and stored procedures, and
how to use both in your VB programs and web applications.
The new XML features of SQL Server 2000 are also covered - you will learn how to execute queries
and stored procedures in the URL of a web browser to retrieve XML data from the database. XML
templates, XSL stylesheets, and XML schemas are also covered, and we show you how to format your
XML data into a presentable format for display in a browser.
SQL Server 2000 includes many useful tools. For example, English Query is a powerful tool for building
applications that allow users to access the data without understanding query languages or the structure
of the database. This book will step you through creating your own English Query application.
We cover the installation of the Personal Edition of SQL Server 2000 and show you how to install
multiple instances of SQL Server 2000 on the same machine. We then move on and discuss relational
database design, and help you get off on the right foot by walking through the design and normalization
of the development database that will be used throughout this book.
Introduction
We discuss SQL Server security and show you how to grant access to the various database objects to
users and roles that we set up. We also cover database connections and how to create DSN and DSN-
less connections from VB using both Windows authentication and SQL Server authentication.
One whole chapter has been set aside to cover the details of the Query Analyzer. This is a powerful tool
that you as a developer will use to write and debug queries and stored procedures. This tool also allows
you to view and manage the objects in your database, such as tables and stored procedures.
Creating and using stored procedures is covered in depth and we walk you through building a sample
application that uses stored procedures to select, insert, update, and delete data. As you progress from
one chapter to the next you will be building upon the previous chapter's content to increase the
functionality of the sample application. By the time you get to the end of the book, not only will you
have gained a better understanding of SQL Server and stored procedures, but you will also have a
complete application that serves as an example for future reference and use.
The last chapters in this book deal with the XML features of SQL Server 2000. The first of these gets
you up to speed with XML and covers some simple formatting of XML data using XSL stylesheets. The
second walks you through the process of creating XML reports that are displayed in a web browser.
The case study, split into two parts, introduces you to English Query and shows you how to build and
deploy an English Query application. English Query is a separate product that ships with SQL Server
2000 - it allows you to build an application that your end users can use to ask natural English questions
to query the database. These questions are translated into SQL statements behind the scenes and are
executed, returning the data that the user has asked for.
2
Introduction
3
Introduction
4
Introduction
Appendix F - References
Although experienced VB developers with little or no knowledge of databases should be able to learn
all of the basics needed, there are two types of VB developers for whom this book is ideal:
o Experienced developers who are making the transition from Access to SQL Server 2000
o Experienced developers who are making the transition from some other type of enterprise
relational database, such as Oracle or Sybase
This book assumes you are an experienced Visual Basic developer and as such will not teach you how
to code Visual Basic, but instead will teach you how to create SQL Server stored procedures and call
them from your Visual Basic programs and web pages.
A basic understanding of relational database concepts will be helpful but is not assumed, as this topic is
covered in the first few chapters of this book. It is also not assumed that you have any experience
working with ADO, but again it will be an advantage if you have.
Since this book is about learning how to use SQL Server 2000, we will step you through installing the
Personal Edition on your workstation.
5
Introduction
You will need Visual Basic 6.0 installed in order to develop and try the examples in this book. You will
also need the Windows NT 4.0 Option Pack if your workstation is running Windows 98 or Windows NT
4.0, in order to tryout the web-based examples.
All code and samples in this book were developed and tested on workstations running Windows 2000
Professional and Server editions.
Conventions
To help you understand what's going on, and in order to maintain consistency, we've used a number of
conventions throughout the book:
Advice, hints, and background information comes in an indented, italicized font like this.
Try It Out
After learning something new, we'll have a Try It Out section, which will demonstrate the concepts
learned, and get you working with the technology.
How It Works
After a Try It Out section, there will sometimes be a further explanation, to help you relate what you've
done to what you've just learned.
Words that appear on the screen in menus like the File or Window menu are in a similar font to what
you see on screen. URLs like http://www.apress.com are also displayed in this font.
Keys that you press on the keyboard, like etrl and Enter, are in italics.
We use two font styles for code. If it's a word that we're talking about in the text, for example, when
discussing functionNames (), <Elements>, and obj ects, it will be in a fixed pitch font. If it's a
block of code that you can type in and run, or part of such a block, then it's also in a gray box:
<html>
<head>
<title>Simple Example</title>
</head>
<body>
<p>Very simple HTML . </p>
</body>
</html>
6
Introduction
<html>
<head>
<title>Simple Example</title>
</head>
<body>
<p>Very simple HTML.</p>
</body>
</html>
In this case, we want you to consider the code with the gray background, for example to modify it. The
code with a white background is code we've already looked at, and that we don't wish to examine
further.
The source code for all of the examples is available for download - more on that in a while. You might
decide that you prefer to type all the code in by hand. Many readers prefer this because it's a good way
to get familiar with the coding techniques that are being used.
Whether you want to type the code in or not, we have made all the source code for this book available
at our web site, in the Downloads section at the following address:
http://www.apress.com
If you're one of those readers who likes to type in the code, you can use our files to check the results
you should be getting - they should be your first stop if you think you might have typed in an error. If
you're one of those readers who doesn't like typing, then downloading the source code from our web
site is a must!
http://www.apress.com
7
Introduction
Errata Be Updates
We've made every effort to make sure there are no errors in the text or the code. However, to err is
human, and as such we recognize the need to keep you informed of any mistakes as they're spotted and
amended.
More details on finding out about errata and providing us with feedback can be found in Appendix G.
8
Introduction to SQL Server 2000
SQL Server 2000 is the latest release of SQL Server and it brings about a lot of changes to the user
interface, as well as performance enhancements in the underlying database engine. If you are new to
SQL Server this product will amaze you with its richness of features and ease of use. If you are
upgrading from a previous version of Sm. Server you will find that SQL Server 2000 has many new
features to offer developers.
This chapter focuses on the core concepts and features of SQL Server 2000 from a developer's
standpoint. We will discuss the basic concepts of databases in SQL Server 2000 and some of the
additional features that SQL Server 2000 has to offer.
The Relational Database Engine is at the heart of SQL Server and provides the majority of the services
that we will be dealing with in this book. The database engine is highly scaleable - it can perform
optimally on a single computer running the Windows 2000 Professional operating system, or can be
scaled up to function on a cluster of servers running Windows 2000 Datacenter Server. We will cover all
of the operating systems that SQL Server 2000 can run on in the next chapter.
Chapter 1
The database engine can also dynamically tune itself. That is, it can acquire and release system
resources as the need arises. For example, if the system is running with 50 concurrent users and 50 more
users log onto the system, SQL Server will automatically acquire the resources necessary. Likewise, if
your transaction log fills up and you have it set to automatically grow, SQL Server will allocate it more
space so the database will keep running. We will discuss transaction logs in more detail later in this
chapter.
Not only does SQL Server provide the database engine, but it also provides many robust user interfaces.
Among these are the Enterprise Manager, which allows us to perform administrative tasks on SQL
Server databases, and the Query Analyzer, a most useful tool for developers. The latter assists the
developer in writing and debugging queries and stored procedures. We will cover both of these user
interfaces in more depth in later chapters, as well as learning what queries and stored procedures are.
As we progress through this and the next several chapters you will come to realize what a powerful
database application SQL Server 2000 is, with easy-to-use interfaces and many powerful features.
The named instance feature allows you to install SQL Server 2000 on a computer already running a
previous version of SQL Server or a default instance of SQL Server 2000. Each additional instance of
SQL Server 2000 installed on the same machine must be given a unique instance name. These names
are limited to 16 characters and are not case sensitive. So if we install a second instance of SQL Server
2000 on SProd1 and give it an instance name Client1 then we would address that instance of SQL
Server as SProd1 \Client1.
Each instance of SQL Server is isolated from the rest. This means that if, for example, your organization
were a service provider, you could install multiple instances of SQL Server 2000 on the same machine
and install additional service packs without affecting the settings of the other copies. The only shared
components between instances are the tools, search services, and the English Query application. Put
simply, everything that is installed in the Microsoft SQL Server program group (for example the
Enterprise Manager, Query Analyzer, and Books Online) is shared between instances and everything
else is isolated. Clients can connect to any instance of SQL Server on a Single machine, providing they
have the correct access permissions.
We will explore named instances in more depth in the next chapter when we actually walk through the
procedure for installing SQL Server 2000.
12
Introduction to SQL Server 2000
0 Tables
0 Keys
0 Indexes
0 Constraints
0 Stored procedures
0 Views
0 Triggers
0 Defaults
0 User-defined functions
0 User-defined data types
0 Users
0 Roles
0 Rules
As we mentioned earlier, SQL Server provides a tool known as the Enterprise Manager - this allows us
to manage all of the databases created in SQL Server from one window. The Enterprise Manager is the
main user interface to SQL Server and allows us to view and manipulate the various objects in our
databases. Using the Enterprise Manager, we can connect to other SQL Servers installed on the network
and administer them all from the same window, as long as we have the appropriate permissions. We will
be covering the Enterprise Manager in the next chapter after we have installed SQL Server.
The user who creates a database is considered the owner of that database. Only that user and the
database administrator will initially have access to the database. (The database administrator is usually
defined as the person or persons who have access to the system administrator login, sa.) This is part of
the security features of SQL Server; all objects are secure until the appropriate permissions are granted.
Chapter 4 will discuss SQL Server security in greater detail and demonstrate how to grant permissions
on various database objects to other users. The database owner or the database administrator must
explicitly grant permissions on the database to other users before they can access or work with the
database. Once this is done the other users can then create objects in the database, such as tables, stored
procedures, and views, depending on the permissions they have been granted.
Database Files
A SQL Server database is organized into logical objects that are visible to the user, such as tables,
indexes, and stored procedures. Behind the scenes a Sm. Server database is actually implemented as
two or more physical files on the file system. The first file is the data file and contains all of the
information that makes up a SQL Server database. The second file is called a transaction log file and
contains the transaction logs, which are records of changes made to the database. Transaction logs will
be covered in more detail in the next section.
A primary data file is the first data file created when you create your database. Primary data files for a
database are created with the . mdf file extension by default. You can change this, but it is not
recommended for the sake of consistency. As your database grows and you run out of room on the hard
13
Chapter 1
drive in which the primary data file was placed you can create one or more secondary data files. These
are usually created with the . ndf file extension by default. Again, you can use whatever file extension
you want but to be consistent with others you should use the default. It also helps to maintain
consistency within your SQL Server installation and aids the quick identification of database files.
Creating secondary files on different drives of your computer will spread the workload of your database
across other drives and thus improve the performance of your database.
Log files are used to hold all of the information needed to recover your database, either from a system
failure or from accidental or purposeful destruction of data. These log files are kept separate from the
data files so that, although they may reside on the same physical volume, they are never created in the
same physical file. Log files are created with the default extension of . Idf and, again, you should not
change this. Wherever possible your log files should be created on separate physical drives to protect
against drive failure.
You can create SQL Server data and log files on either FAT or NTFS file systems. You cannot,
however, create a data or log file on a compressed volume in these file systems. FAT stands for File
Allocation Table and is a file system that has been around since DOS. Windows 95/98 and, optionally,
Windows NT12000 use the FAT file system. NTFS is an acronym for NT File System and is used
exclusively by Windows NT12000. This file system provides security and recovery features not available
in the FAT file system.
The following diagram shows the implementation of the logical database that you see into the physical
database that SQL Server uses. The logical database is the database that you see in the Enterprise
Manager and the physical database is the group of files that make up the database on your hard drive.
Database A contains a primary data file that has been populated to capacity, meaning there is no more
space available in this file. Therefore a second data file was created for this database with a file
extension of . ndf, indicating that it is a secondary database file. Each database in the diagram has its
own transaction log file, which is used to record the transactions that occur in the database. Database B
in the diagram only contains a primary data file and a transaction log file:
. Database A
Data 1
Database A
Data 2
I Database B
Data
.mdf .ndf .mdf
l
Database A
Log
.Idf
Database B
Data
.Idf
:
:
II
'
14
Introduction to SQL Server 2000
SQL Server as the database management system (DBMS) actually resides in the middle, as shown in the
diagram, managing the physical implementation of the database in the file system and also the logical
database that users interact with. It uses various programs to manage the physical database files, such as
the relational database engine and the storage engine. It also uses various programs to manage the
lOgical database, such as the Enterprise Manager and the Query Analyzer.
As a developer you shouldn't be too concerned with the physical implementation of the database files
but it helps to understand the big picture. An understanding of what goes on behind the scenes is useful
when you need to design databases and communicate with the database administrator. However, what
you are really concerned with is the logical implementation of the database, such as tables, keys, and
indexes. These are the things that you can control to optimize the way your database performs. For
clarity, the objects listed at the top of the diagram represent only a partial list of the objects that make
up a database.
Chapter 3 will help you to better understand how databases are implemented in SQL Server, as we step
through creating our own development database.
Transaction Logs
As we mentioned above, each database that you create has its own transaction log. The transaction log
contains details of transactions that have been applied against your database. A transaction is the
execution of a group of SQL statements as one logical unit of work.
SQL is an acronym for Structured Query Language. Any application that accesses SQL Server does so
through the use of SQL statements, which perform such actions as selecting data, and creating and
modifying the structure of your database.
SQL Server automatically manages transactions within the transaction log and will record a "before and
after" picture of the data in a table that has changed. This means that if you execute an update query to
revise a row of data, SQL Server will log a record of the data before and after it was changed. This
allows for both backward and forward recovery of the data in your database, should the need arise.
o A forward recovery means that if you have a hardware failure, you can restore your database
from the last backup, and then apply the transaction logs to recover the transactions from the
point of the last backup.
o A backward recovery means that if your stored procedure or business component implements
transactions, and somewhere in the processing your code decides that it needs to back out of
those transactions, the transaction log will be used to recover the data to the state the data was
in before the changes began.
SQL Server manages transaction logging automatically. You can, however, use transactions in your
queries and stored procedures to perform automatic recovery of the data that you changed. Transactions
will be covered in depth in Chapter 11 where we will show you how they work and also how to
implement them in your stored procedures.
Incremental backups of your transaction logs should be performed on a regular basis, and the database
administrator normally handles these. Incremental backups can be used to recover transactions that
were processed since the last time your database was backed up. This is useful when you need to restore
and recover your database after a hardware failure. Performing incremental backups also serves to clear
the transaction log file, making room for new transactions.
15
Chapter 1
You can truncate the transaction log to remove old records that are no longer needed. SQL Server will
automatically truncate the transaction log when a backup of the log is performed. It also automatically
truncates the file when a checkpoint is processed and the Truncate Log On Checkpoint option is turned
on for the database. With this option turned on you could potentially lose transaction records if the log
is truncated without first backing it up.
A checkpoint is used to minimize the amount of data in the transaction log that must be processed to
recover the database. When a checkpoint of the log is taken, it writes unsaved changes to disk, making
them a permanent part of the database. SQL Server will store as many transactions in memory as it can
before writing them to disk - this is just one way that SQL Server optimizes performance. When this
process is completed, the pages of the transaction log are free to be used by new transactions. SQL
Server automatically performs checkpoints on the log and uses the blocks that have been freed up. A
checkpoint is automatically performed, based on the number of records in the log and not based on the
time since the last checkpoint.
Tables
Databases contain many different types of objects but the table is perhaps the most fundamental of
these. A table is an object in your database that contains information. You could create a table that
contained data about employees and this table would represent information about each employee in
your organization. Each table that you define is made up of columns and rows. Each column represents
an attribute about the information that is stored in your table, such as an employee's title and first or last
name. Collectively, the columns form a row in your table that represents a single occurrence of the
information that the table represents, which in this case is a single employee.
The following partial table is taken from the Employees table in the sample Northwind database that
is installed with SQL Server. Notice how each column represents an attribute of the employee being
defined and each row represents a single employee:
Each database in SQL Server contains a collection of tables. These include multiple system tables. SQL
Server creates these system tables when we initially create a database and they are used to manage
information about the database. As users we create one or more user tables that contain the information
that we want to store in the database, such as products and suppliers. These tables contain data that is
related in some way, such as a supplier who supplies parts to manufacture a product. This is part of
what makes up a relational database - the relationship of objects. We'll be discussing the concept of
relational database design in more detail in Chapter 3.
A table can contain up to 1,024 columns but it is highly unlikely that we would have that many
columns. We usually normalize our database and end up with more tables and fewer columns.
Normalization is the process of eliminating duplicate data and providing a fast efficient search path to
the data, which will also be covered in detail in Chapter 3.
16
Introduction to SQL Server 2000
Each column in a table must have a unique name within that table, but you can use the same column
name in multiple tables. Along the same lines, each table in a database must have a unique name but,
again, you can have the same table name in different databases.
As we mentioned earlier, each table you create is secure and no other user can access it until you grant
them permission. There are different levels of permissions that can be granted on a table to each user or
role. A role is assigned a unique name, and defines a group of users who have the same permissions.
You can, for example, allow one group of users to select data, while allowing another user to both select
and insert data, by placing them in different roles. Object level permissions and roles will be discussed
in detail in Chapter 4 when we look at SQL Server security.
Each table in a database can contain one or more objects, such as constraints, triggers, or defaults.
These objects help to preserve and enforce data integrity within your tables. Data integrity ensures
that each column in a table contains the correct data values. These topics will be covered later in
this chapter.
Each table in a database usually has a special column, called an identity column, which uniquely identifies
each row of data. Generally, this column contains a sequential number that is automatically incremented
by SQL Server, although other values are possible, as will be discussed in more detail in Chapter 3.
Identity columns are typically used in SQL Server to assign a unique number to each row in a table,
which will ensure the uniqueness of that row's data. This column is also typically used as the primary
key column, although it can alternatively be used in the index. We will be discussing primary keys and
indexes next.
When a primary key is created on a table, SQL Server automatically creates a unique index for the
primary key on the table. This ensures that no two primary keys can be the same. Indexes are covered in
more detail in the next section. For now it is enough to know that using an index on the primary key
column provides a fast, efficient path to the data when the primary key is used for data access.
If a primary key consists of data from multiple columns, the individual columns can contain duplicate
values but, when taken as a whole, the reference must be unique. In other words, if a primary key
consists of data from column A and column B, column B can contain duplicate values or column A can
contain duplicate values. However, the combination of columns A and B must be unique within each
row of the table.
Foreign keys are keys that point to the primary key in another table. A foreign key in one row of a table
points to an exact row of data in another table. A foreign key value cannot be inserted into a table if the
row of data that it is pointing to in another table does not exist. This is just one of the constraints that
are placed on foreign keys which help to ensure referential integrity.
17
Chapter 1
Consider the following diagram as an example. We can have more than one employee sharing the same
title, so we have moved the Ti tle column into a separate table. This reduces the amount of duplicate
data, and then the two tables are joined using a foreign key. The following figure shows how the foreign
key, Ti tleID, in the Employees table, points to the primary key in the other table. This approach
provides more efficient storage of the data, as we need only store a foreign key pointing to one row of
data in the Title table.
This example also demonstrates referential integrity; suppose we had not inserted the second row of
data in the Ti tle table. The foreign key constraint would not allow us to insert a value of 2 in the
Ti tleID column of the Employee table for the second employee.
1
EmployeelD LastName FlrstName
1.
TltlelD
Employees table 1 Davolio Nancy 1-
2 Fuller Andrew 2 -~
3 Leverling Janet 1- ~ r-
Primary Key
1
TltlelD Title
Title table 1 Sales Representative
2 Vice President, Sales
Referential integrity enforces the defined relationship of data between tables, and is automatically
applied to foreign keys. Just as we cannot insert a foreign key value for a row of data that does not exist
in another table, referential integrity prevents us from deleting a row of data that is referenced by a
foreign key. In order to delete a row of data that is referenced by a foreign key, we must first delete the
row of data containing the foreign key or update the column using a null value. Then we are able to
delete the row containing the primary key.
Referential integrity is based on the relationship between foreign and primary keys and it ensures that
key values are consistent across all tables. Referential integrity is automatically enforced by SQL Server,
and prevents a user from updating a primary or foreign key that would break the integrity of the data.
Also, as we mentioned earlier, SQL Server prevents you from inserting a foreign key that does not
reference a valid primary key, and additionally prevents you from deleting a primary key that is being
referenced by a foreign key.
18
Introduction to SQL Server 2000
The ON UPDATE cascading constraint specifies what action should be taken on the foreign keys that
reference the primary key in the table when the primary key is updated. NO ACTION, which is the default
when this constraint is not specified, will cause SQL Server to take no action. In this case an error is
raised when a user tries to update the primary key column that is referenced as foreign keys in other
tables. CASCADE specifies that an update to the primary key should be cascaded to all foreign keys that
reference this primary key.
Let's look at an example of ON UPDATE CASCADE and use the tables shown in the previous figure.
Suppose we updated the value for the column Ti tleID from 1 to 100 in the Ti tle table. This change
would then be cascaded to the Employees table and all employees who had a TitleID of 1 would
now have a Ti tleID of 100, as shown in the following figure:
•I
EmployeelO
...I
LastName FlrstName TltlelO
-
Employees table 1 Davolio Nancy 100-
2 Fuller Andrew 2 -
3 leverling Janet 100- r-
Primary Key
1
Title table
TltlelO
100
Title
Sales Representative I
2 Vice President, Sa les
Cascading updates are useful in situations where the primary key requires changing.
The ON DELETE cascading constraint specifies what action should be taken on the foreign keys that
reference the primary key in the table when the primary key is deleted. Again, NO ACTION is the default,
and will cause SQL Server to take no action. Just as with ON UPDATE, an error is raised when a user
tries to delete the primary key column that is referenced as foreign keys in other tables. CASCADE
specifies that the deletion of the primary key should be cascaded to all foreign keys that reference this
primary key. In other words, all rows that have foreign key references to the primary key are deleted.
Using our previous example, if we deleted from the Ti tle table the row of data in the Ti tleID
column that now contains a value of 100, all rows in the Employee table that have a foreign key
reference to this deleted primary key would also be deleted.
This is useful in situations where related items should be deleted, such as for tables of suppliers and
their products. If you deleted the supplier, you would also want to delete the products they supplied.
Indexes
An index is an object that is associated with tables and is built using one or more columns from a table.
Just like an index in a book, it prOVides a means for looking up specific data. Indexes store information
from columns (usually primary and foreign key columns) along with the exact location of the associated
data within the table. Using an index to access information in a table is very efficient as SQL Server
makes use of the index to find the exact location of the row of data that you want retrieve or update.
19
Chapter 1
There are two different types of indexes in SQL Server - clustered and non-clustered.
Clustered indexes sort the data in the table rows by key. You can think of a clustered index as being
like a phone book. The columns that define the index (for example, the phone owner's last name then
their initial) are used to sort the table rows. This provides a very efficient means to access data in the
table. However, since a clustered index sorts the data in the table, there can be only one clustered index
for each table.
A clustered index actually stores the data rows of the table in the bottom leaf of the index. This means
that the index consists of the index entries pointing to each row of data, and the data rows are stored at
the end of the index.
Non-clustered indexes store the keys of the table in the index and contain pointers to where the data
actually resides in the table. The pointer in a non-clustered index is called a row locator because it
actually locates the row of data in the table. If the table does not have a clustered indexed defined, the
row locator in a non-clustered index contains a pointer to the row of data in the table. If a clustered
index is defined on a table, the row pointer contains the clustered index key. You can define as many
non-clustered indexes on a single table as you see fit.
Indexes can either be unique or not. Indexes that are unique do not allow duplicate keys (keys that
contain the same data value), while indexes that are not defined as unique may contain duplicate keys.
Index keys should not be confused with primary keys in a table. Any column in a table can be used as
the key column for an index.
Regardless of type, simply placing an index on your tables for the columns that are used to access data
will generally confer a speed advantage. This is true whether the access is by means of SELECT,
UPDATE, or DELETE statements. However, when you define an index on a table, SQL Server must
maintain the entries within that index and this requires extra overhead. This is usually offset by the
increased efficiency the index provides, especially for larger tables with thousands of rows or more.
Each INSERT, UPDATE, and DELETE statement performed against a table must also be used to update
the index. SQL Server automatically takes care of keeping the index in sync with the table.
When designing indexes for your tables, you should consider what types of SQL statements are going to
be used to select, insert, update, and delete data in your tables. You will usually want to define indexes
on columns that are specified in the WHERE, ORDER BY, and GROUP BY clauses. These will be covered in
detail later, for now an example of a SELECT statement that uses a WHERE clause is:
In this case we only select the first and last name from the Employee table where the EmployeeID has
a value of 4. If the EmployeeID column were defined as the index key, the SELECT operation would
be more efficient.
We will be working with indexes in Chapter 3 when we design and build our database. Actually
creating the indexes will help you to gain a better understanding of how to use and create them.
20
Introduction to SQL Server 2000
Defaults
Defaults are values that are automatically placed into a column when a new row of data is inserted and
no value has been specified for that column. In order to have a default value inserted, you must first
define the default and specify the columns to which it should apply. Default definitions are commonly
used to specify a zero for numeric columns, instead of having a null value inserted into them, as this
prevents problems when carrying out sorting operations, comparisons, or calculations.
Each column in a table can be assigned only one default. Identity columns cannot have defaults applied
to them nor can columns that contain the Rowversion data type, as the Rowversion data type is a
database-wide unique number.
A default value can be any constant or an expression that evaluates to a constant. For example,
expressions could be mathematical formulae or SQL Server functions, such as GETDATE () that returns
the current date and time.
When a column in a table does not allow null values and no default has been defined for that column,
you must specify a value for it when inserting data into the table or you will receive an error.
You can specify a default value for a column when a table is created, or you can alter the table and add
a default at a later date. However, if you apply a default to an existing table it is only applied to new
rows that are added - the existing rows are unaffected. You can also create a default as an object in the
database and share it between many tables. When created this way you can bind a default to multiple
columns in multiple tables.
Stored Procedures
A stored procedure is a group of T-SQL statements stored under a unique name and executed as a unit.
A stored procedure can have multiple T-SQL statements to perform such tasks as selecting data from
one table and updating data in another table.
As we mentioned earlier, SQL is an acronym for Structured Query Language. T-SQL is an acronym for
Transact Structured Query Language. SQL complies with the American National Standards Institute
(ANSI) SQL standards, while T-SQL is Microsoft's version of SQJ. that is based on ANSI SQL. The
latest version of ANSI SQL is referred to as SQL-99. Remember, any application that accesses SQL
Server does so through the use of SQL statements, which perform such actions as selecting data, and
creating and modifying the structure of your database.
Stored procedures should not be confused with queries, as queries are not stored in the database and
cannot be accessed by other applications. Queries are simply ad hoc T-SQL statements that you write
and execute in the Query Analyzer. They can be saved, but only as a file on your computer - SQL
Server does not know anything about them.
Stored procedures increase application performance. Firstly, there are less SQL statements to be
transmitted across the network as you only need to send the name of the stored procedure and any
parameters it requires. Secondly, stored procedures are parsed and optimized when they are created
and are compiled on the first execution, so they require less processing.
Stored procedures are similar to functions in other languages, as they can contain both input and output
parameters and can return values. They use logic to control the flow of processing, and there are
numerous functions and T-SQL statements that can be used in stored procedures.
21
Chapter 1
You can use stored procedures to execute routine functions such as selecting, inserting, updating, and
deleting data. A single stored procedure can be executed by multiple applications, thus providing code
reuse. Stored procedures can also be used to perform database functions, such as backing up your
database and transaction log. A simple stored procedure is listed in the following code fragment:
1D INTJ AS
itl
oy ID
Each stored procedure contains the CREATE PROCEDURE keywords to instruct SQL Server to create the
stored procedure. Then a name is assigned to the stored procedure, and any parameters it expects are
declared. The example listed here shows a name of up...parmsel_employee, and an input parameter
of @EmployeeID.
This is followed by the T-SQL statements and functions that are to be performed in the stored
procedure. In this example, the stored procedure will accept one input parameter, the employee ID, and
then select the employee's first name, last name, and title from the Employees table where the value in
the EmployeeID column matches the value in the @EmployeeID input parameter.
Stored procedures can be used to shield the complexities of the database from the users. All they need
to know is what stored procedure to execute and what parameters (if any) it expects, in order to get the
results they need. They do not need to know the relationship of the tables or even what tables exist in
the database.
SQL Server caches the stored procedure's execution plan in memory when the stored procedure is
executed. The cache is an area of memory that SQL Server uses to keep objects. Subsequent executions
of the stored procedure are executed using the copy in cache, thus optimizing the performance of your
application and SQL Server. SQL Server does a lot to optimize stored procedures, and using them has
many performance advantages over in-line SQL statements. In-line SQL statements are coded directly
into your program as a string and then sent to SQL Server for execution.
Chapter 7 will introduce stored procedures in more detail, and Chapter 8 explores the performance
benefits of using stored procedures over in-line SQL statements. We will learn how to create stored
procedures in SQL Server and then call them from our Visual Basic programs.
Triggers
Triggers are a special class of stored procedures and also contain T-SQL statements. However, instead
of executing a trigger like you would a stored procedure, a trigger is defined to execute automatically
when certain actions (insert, update, delete) are performed against a table. For example, you can define
a trigger that is to be executed when a DELETE statement occurs on a particular table. Then, when the
DELETE statement is processed, the trigger is executed by SQL Server. This trigger can perform such
actions as logging the record deleted and the user who performed the deletion.
Triggers are most often used to enforce the business rules and complex constraints that are defined by
your business requirements. Triggers can be used to create an audit record of the changes made to a row
of data, along with details of the user who made the changes. We will see this in action in Chapter 12
when we create our own triggers.
22
Introduction to SQL Server 2000
You can have multiple triggers for one table as long as each trigger has a unique name. Triggers can
also cause other triggers to be fired when an action is performed on another table that has a defined
trigger, thereby increasing their effectiveness and scope. Because triggers can contain complex
processing logic using T-SQL statements and functions, they are often used to help enforce data
integrity. This is especially true when one trigger calls another to delete related data. You can nest up
to 32 levels of triggers, having each perform an action that causes another to be executed, and so on.
Views
A view is like a virtual table containing data taken from one or more other tables. It is stored in the
database as the actual T-SQL statements that define the view, just like a stored procedure. When the
view is referenced, the virtual table is then created using the T-SQL statements contained in the view.
Views are generally used to let users see data from multiple tables all at the same time, thereby giving the
illusion that the data exists as a single table or group of data. The benefits of this are that it provides the
user with the illusion that all of their data is in one table, and hides the complexities of the database from
them. It also provides a security mechanism as we can grant users access to the view but not to the actual
tables from which it is derived, thereby limiting their access to only the data they are authorized to see.
Views can also be defined to be updateable. That is, they can actually update data that resides in
multiple tables. There are strict guidelines that must be adhered to in order for a view to update data in
the underlying tables. The view cannot use any aggregate functions in the SELECT list. Aggregate
functions are functions provided by SQL Server that perform calculations on the values in a column
from multiple rows, and return a single result. Also views cannot contain the TOP, GROUP BY, UNION, or
DISTINCT clauses that allow you to control how data is returned.
Views are flexible in that they allow you to execute other views and stored procedures to achieve the
end results. However, this flexibility only goes so far and there are some restrictions that are imposed on
views. For example, you cannot use the ORDER BY, COMPUTE, or COMPUTE BY clauses or the INTO
keyword. These will be defined in later chapters - they affect how data is returned and manipulated.
It is also not possible to use temporary tables within views. These tables are very similar to permanent
tables except they are stored in the TempDB database and are automatically deleted by SQL Server
when your session ends. Populating a temporary table is usually done using the INTO keyword within a
SELECT statement. As this keyword is not permitted in views, the temporary tables that depend on
them cannot be used either. We will cover temporary tables in detail later in this book.
23
Chapter 1
The following diagram illustrates how these technologies fit in with SQL Server:
VB 01' Vi b
VB Applleatlon VB AppilcallOll
AppliC8\JOn
ADO
"
ROO OAO
SQl Server
SQL Server
Daumases
Open Database Connectivity (ODBC) is an API that allows lower-level languages, such as Visual C++,
to access various databases. ODBC is a high performance API used by tools, utilities, and system level
applications. It is an older technology that has been built upon by many database vendors and third
party suppliers of ODBC drivers.
ODBC is a complex API that even VC++ developers find hard to master. Given this, Microsoft built
several objects that reside on top of ODBC to make it more user-friendly. These include the Microsoft
Foundation Classes (MFC), Data Access Objects (DAO), and Remote Data Objects (RDO). These
provide an easier-to-use interface when compared with using ODBC directly, and most developers will
have used these objects at one time or another.
As time progresses, so does technology, and OLE DB (Object Linking and Embedding DataBase)
entered the scene. OLE DB is a low-level COM (Component Object Model) API that is used to access
information from just about any type of data store, not just databases. SQL Server ships with Microsoft's
version of the OLE DB API. This API provides high performance access to SQL Server and supports
the SQL-92 syntax, which makes it compliant with the OLE DB 2.0 specification. Tools, utilities, and
system-level development also use this API when high performance is needed.
While OLE DB provides an API that is easier to use than ODBC, it isn't ideal for every developer
because of its complex API interface. So ADO (ActiveX Data Objects) has been created as a COM
object to provide an interface with OLE DB. ADO provides an easy to use, lightweight COM object
suitable for general business applications. ADO is considered lightweight because of the size of its DLL
(Dynamic Link Library) when compared to those of DAO and RDO.
24
Introduction to SQL Server 2000
ADO has evolved from DAO and RDO, providing an interface that is easier to learn and use. It also
provides a feature set that most applications need to access data, whether that data resides in a flat file, a
database, or on the Internet. Because ADO is a COM object it can be used by any programming language
and technology that supports COM, for example Visual Basic, Visual C++, and ASP scripting languages.
Chapter 6 provides a general overview of the ADO object model, and a more detailed introduction to
ADO and how it can be used to enable database access from our VB and web applications.
XML
SQL Server 2000 provides native support for Extensible Markup Language (XML), a markup language
that is used to describe structured data. Not only can an XML document provide data but, through the
use of descriptive tags, it can also indicate the structure of that data. SQL Server 2000 provides native
support for this, meaning that you can select data from a table in SQL Server and have the results
returned as XML data. SQL Server 2000 also provides a useful utility to set up a virtual directory in
Internet Information Server (lIS) that allows the user to access a SQL Server database through the
Universal Resource Locator (URL) of a web page. A virtual directory prOVides the necessary association
between lIS and SQL Server.
What does all this mean? It means that you can query data in your database through the URL of a web
page. Take a look at the following URL:
http://LOCALHOST/NORTHWIND?SQL=SELECT+*+FROM+EMPLOYEE~+WHERE+EMPLOYEEID+=+l+FOR+XM
L+AUTO,ELEMENTS
This URL specifies a virtual root of NORTHWIND, which has been set up to point to the Northwind
database in SQL Server. The SQL SELECT statement selects a specific employee (with EmployeeID =
1) from the Employees table and returns the results. Notice all the plus signs in the URL. This is a
special character used to represent a space, as spaces are not allowed in a URL. This SELECT query
produces the following results:
- <EMPLOYEES >
<EmployeeID> 1 < / EmployeeID>
< Last Name > Davolio < /LastName >
< FlrstName> Nancy< /FlrstName >
<Title > Sales Representative <jTitle>
< TltleOfCourtesy > Ms. < jTltleOfCOurtesy>
< 61 rth Date> 1948-12-08TOO: 00: 00 < /6I rth Date >
< Hi reDate> 199 2-0S-01 TOO;OO; 00 < / HireDate>
< Address > S07 - 20th Ave. E. Apt. 2A < /Address>
<Clty > Seattle< /City >
< Region > WA< /Region >
< Posta1Code > 98122 < /PostaICode >
<Country > USA< /COuntry >
< HomePhone > (206) SSS-98S7 < / HomePhone>
,.,J: vt-n ........ inn ""' C;A,;~ "..
~~.~~--~=-=-----------==========w=~~==~~
,&:v ..,....r'tri,.....n .....
~
25
Chapter 1
As part of the native support for XML, SQL Server 2000 also provides a new keyword for the SELECT
statement called FOR XML. This new keyword returns data from the SELECT statement as XML
documents instead of the standard rows that we are used to.
This new keyword allows us to write queries and stored procedures that return data as XML. We can
then use these queries to return XML to our web pages and VB programs. In the previous example we
used an XML mode of AUTO. The mode determines the shape of the XML tree returned by SQL Server.
We also used the ELEMENTS argument, which specifies that columns in the table be returned as sub-
elements in XML. You can also define your own XML stylesheets, for example to display the data
returned from a SELECT statement in tables on your web page. These topics will be covered in more
depth in Chapter 15, where we'll take a closer look at the syntax and use of each of these features.
English Query
English Query is a separate product that ships with SQL Server 2000. It provides an environment for
creating applications that allow users to ask questions in natural English, instead of writing a SQL query to
retrieve the data they want to see. This makes the database accessible to even the most non-technical end
users, by concealing its underlying structure and negating the need to be conversant with SQL grammar.
For example, suppose a user wanted to know the title of Andrew Fuller in the Employees table of the
Northwind database. Instead of creating a SQL query to retrieve the information, they could simply ask
the question" What is Andrew Fuller's Title?". The English Query application would then build and execute
the appropriate SELECT query behind the scenes to retrieve the information and display it to the user.
English Query works best with normalized databases, so you should ensure that your database design
has been normalized. You must also ensure your database contains data so you can build, test, and train
your English Query application. It can then be published using Visual Basic or the Web, meaning that
you can deploy your English Query application though VB if your target audience is small, or use an
intranet or the Internet if your audience is great, or spread over multiple locations.
The case study (parts 1 and 2) provides an in-depth look at creating and deploying an English Query
application over the Web.
Analysis Services
Analysis Services, formerly known as OLAP, is a service that builds multidimensional cubes of data
retrieved from data warehouses (large databases that contain historical data about your business). These
multidimensional cubes contain both dimension and summary data held in cells, each addressed by a
set of coordinates that specify a position within the structure's dimensions. For example, imagine you
wanted to track sales of a number of components over a period of time - you could build a cube to
represent this data. In this case the dimensions would be component, sales, and time. The data would be
pulled from the data warehouses to build the results.
The data is used for analysis, and can be viewed from Microsoft Excel using the PivotTable service. If
you don't want to use Excel, you can also use ADO Multidimensional extensions to access the data.
Cubes of data can also be write-enabled so users can perform different scenarios on the data.
26
Introduction to SQL Server 2000
Because of the complexities of Analysis Services, SQL Server provides a number of wizards to help you
work with and build these data structures. There are wizards available to help you build the cubes of
data and also to create shared dimensions for use by other cubes.
Analysis Services was built as a technology to allow client applications efficient access to data stored in
data warehouses. It provides a multidimensional model making it easy for the user to navigate and
select information. You can use it to create views of data using ad hoc calculation functions, and to view
complex business data relationships.
You can process data from various data warehouse databases, such as SQL Server and Oracle (using OLE
DB). In fact, any database that supports OLE DB can be used as a data source for Analysis Services.
Part of Analysis Services functionality is a feature called Data Mining. It allows you to perform data
analysis and prediction within Analysis Services. Data Mining can be used to perform analysis of both
relational and multidimensional data. It provides the means to build Data Mining Models, which
contain predictive analysis of relational or multidimensional data.
So what exactly is meta data? Meta data is information about data. That is, it provides property
information such as the type and length of the data in a column. It can also specify the structure of the
data or the design of objects, such as the cubes used in Analysis Services.
The Meta Data Services provides a way for you to store and manage meta data. SQL Server provides a
browser that allows you to view the data in the repository. This can be run from within the Enterprise
Manager or as a snap-in to the MMC console.
DTS
DTS (Data Transformation Services) is a component of SQL Server that provides graphical tools and
programmable objects enabling you to consolidate data from multiple sources into a single source. Not
only are you able to consolidate data, you are also able to extract and transform the data from multiple
sources prior to consolidation.
DTS is based on the OLE DB architecture and allows you to copy and transform data from Oracle to
SQL Server using native OLE DB providers. For data sources that do not support OLE DB, SQL
Server's OLE DB provider can use ODBC to copy and transform data. SQL Server itself uses DTS to
copy and transfer data and objects from one SQL Server installation to another.
27
Chapter 1
Summary
This chapter has introduced SQL Server 2000 at a high level. We have covered the basics of SQL
Server 2000 and have found that it is actually a family of products that combine to make up a very
powerful and rich relational database, loaded with features.
We have also explored databases in SQL Server and now know that they are made up of several
different objects, such as tables, keys, and indexes. Having explored the various database objects, we
can now see how they all work together to help provide secure and reliable data. Through the use of
primary and foreign key constraints, SQL Server can enforce the rules of referential integrity, which
helps to ensure that our data is reliable and consistent.
We took a quick look at how our applications communicate with SQL Server, and learned that ADO
provides an easy-to-use object model that simplifies this communication process.
Having briefly covered some of the other features of SQL Server 2000, such as XML support, English
Query, Meta Data, and Analysis Services, we can see that SQL Server 2000 has a lot to offer through
additional complementary features and services.
We saw how the XML features of SQL Server 2000 allow us to access data residing in our databases
over the Web, or through VB programs. We also discovered that SQL Server provides native support to
return the data in XML format straight from the database.
In the next chapter we will install the Personal Edition of SQL Server 2000 and cover some of the tools
that are available. This will help set the stage for the chapters that follow, as you become familiar with
the user interfaces of SQL Server 2000.
28
Installing the Personal Edition
of SQL Server 2000
Having just had an overview of SQL Server 2000, you are probably ready to install this product and
begin working with it. This chapter will help you do just that.
SQL Server 2000 comes in several different editions, each designed to meet a specific need. And while
we will briefly cover each of these editions, our main focus will be on the Personal Edition of SQL Server
2000. This edition provides most of the features available and allows us to install it on our workstations.
We will cover the supported platforms for each edition and the prerequisites for installing the Personal
Edition. We will then go through the installation process, explaining each step.
Once our installation has been completed, we will take a tour of the Enterprise Manager to acquaint you
with the features of this tool. This is the main user interface used to administer databases in SQL Server.
We will also take a brief look at some of the other tools and wizards that come with SQL Server, which
help to simplify various administrative tasks.
o Discuss the differences in the SQL Server 2000 editions and suitable platforms
o Cover SQL Server 2000 prerequisites
o Step through installing SQL Server 2000 and SQL Server instances
o Tour the Enterprise Manager
o Preview the Query Analyzer and SQL Profiler
o Preview common wizards
Chapter 2
Enterprise Edition
We start with the Enterprise Edition. This is a full-featured edition of SQL Server 2000, and scales to
meet the demands of the largest web sites and data warehousing applications. The Enterprise Edition of
SQL Server 2000 is the edition that most companies would run in an environment where SQL Server
needs to be clustered and the volume of transactions is high. You would most likely find this edition
installed at dotcom-type companies where there is a high volume of online transactions.
This edition contains features such as Full-Text Search, Multiple Instance Support, Log Shipping, and
Failover Clustering.
Full-Text Search is a feature of SQL Server that allows you to search for words or phrases in a character
column of a table. Multiple Instance Support means that multiple named instances of SQL Server can
be installed on the same machine. Log Shipping is a feature that allows you to have transaction logs
automatically shipped to a SQL Server installed on another machine and recorded. This provides a hot
standby machine in case the primary SQL Server machine fails. Failover Clustering provides a means of
having SQL Server failover onto another SQL Server on a cluster of machines should a hardware failure
occur on the node that SQL Server is running on.
Similar to the Enterprise Edition is the Enterprise Evaluation Edition. This is a full-featured evaluation
edition of SQL Server 2000 that will expire after 120 days. The Enterprise Evaluation Edition will run
on the same operating systems as the Enterprise Edition. You can download this evaluation edition for
free at http://www.microsoft.com/sql/.
Developer Edition
The next edition available is the Developer Edition. This edition of SQL Server 2000 has all of the
functionality and features of the Enterprise Edition but is licensed only for development and testing. You
cannot legally run this edition of SQL Server in a production environment. This edition will run on:
o Windows 98
o Windows NT 4.0 Workstation
o Windows NT 4.0 Server
32
Installing the Personal Edition of SQL Server 2000
If running this edition on Windows 98, the Desktop Engine is used, which provides less functionality
(for example, no Full-Text Search). The Desktop Engine will be covered shortly.
Personal Edition
The Personal Edition of SQL Server was primarily designed for mobile computing users. This edition of
SQL Server is also ideal for applications that need a standalone installation of SQL Server on the client
machine. This edition will run on:
0 Windows 98
0 Windows NT 4.0 Workstation
0 Windows NT 4.0 Server
0 Windows NT 4.0 Server Enterprise Edition
0 Windows 2000 Professional
0 Windows 2000 Server
0 Windows 2000 Advanced Server
0 Windows 2000 Datacenter Server
The Full-Text Search and Multiple Instance features are supported in this edition, however the Full-Text
Search features are not available when running Windows 98.
Standard Edition
For small workgroups and departments SQL Server Standard Edition fits the bill, and should provide
all the functionality needed by these groups of users. This edition runs on server operating systems only:
This edition also supports the Full-Text Search and Multiple Instance features.
33
Another Random Scribd Document
with Unrelated Content
The Project Gutenberg eBook of Histoires
magiques
This ebook is for the use of anyone anywhere in the United States
and most other parts of the world at no cost and with almost no
restrictions whatsoever. You may copy it, give it away or re-use it
under the terms of the Project Gutenberg License included with this
ebook or online at www.gutenberg.org. If you are not located in the
United States, you will have to check the laws of the country where
you are located before using this eBook.
Language: French
Histoires magiques
DIXIÈME ÉDITION
PARIS
MERCVRE DE FRANCE
XXVI, RVE DE CONDÉ, XXVI
MCMXXIV
DU MÊME AUTEUR,
SIXTINE.
Le Fantôme. Le Château singulier. Théâtre
LE PÈLERIN DU SILENCE.
muet. Le Livre des Litanies. Pages retrouvées.
LES CHEVAUX DE DIOMÈDE.
D'UN PAYS LOINTAIN.
LE SONGE D'UNE FEMME.
LILITH, suivi de THÉODAT.
UNE NUIT AU LUXEMBOURG.
UN CŒUR VIRGINAL. Couverture de G. d'Espagnat.
COULEURS, suivi de CHOSES ANCIENNES.
HISTOIRES MAGIQUES.
DIVERTISSEMENTS, poésies complètes, 1912.
Critique, Littérature.
JUSTIFICATION DU TIRAGE
A Louis Denise.
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
(Georg., I, 477.)
II
Don Juan fit encore une plus admirable conquête, celle d'une
âme,—une âme ingénue et fière, tendre et hautaine, d'une
séductrice douceur et d'une séductrice violence, et une âme qui ne
se connaissait pas, une âme pleine d'instinctifs désirs, une âme
délicieusement naïve.
Il s'était approché, paré de toutes ses séductions, le geste
douloureux atténué par un peu d'ironie dans l'œil et un peu de joie
sur les lèvres; sa démarche lente de créature trop aimée se
corrigeait par un fier redressement de tête, et le premier long soupir
brisé qui sortit de sa poitrine fut accompagné d'un frappement de
pied subtilement impatient,—comme pour dire: «Vous m'avez blessé
le cœur; je ne puis m'empêcher de vous aimer, mais j'en éprouve de
la colère.» Ensuite, il fit le regard de la bête traquée; ensuite, il joua
à regarder son petit doigt.
Après quelque silence, il susurra amoureusement: «Il fait beau,
ce soir»,—et tout de suite la jeune femme répondit: «C'est mon âme
que vous me demandez, Don Juan! Eh bien! prenez-la, je vous la
donne.»
Don Juan accepta l'âme délicieusement naïve et si féminine que
la soudaine amoureuse lui offrait avec sa peau, ses cheveux, ses
dents, toutes ses beautés et le parfum de tous ses arcanes,—et,
ayant joui de la soudaine amoureuse, il s'éloigna.
De l'âme, il se fit un candide et invincible manteau où il se
drapait, ainsi qu'en des plis de velours blanc,—et, orné d'une telle
âme, plus triomphant qu'un tueur de Mores, plus adoré qu'un pèlerin
de Saint-Jacques ou qu'un revenant de Palestine, il poussa ses
conquêtes jusqu'au nombre de mille et trois.
Toutes! toutes celles qui peuvent donner un plaisir nouveau, une
nuance nouvelle de joie, toutes se laissaient prendre par celui qui
avait pris à leurs sœurs tout ce qui plaît. Elles venaient au-devant de
lui, et, lui baisant les mains, faisaient leur soumission, amoureuse
peuplade vaincue déjà par l'approche du vainqueur.
Bientôt, elles se battirent à qui serait la première soumise et la
plus soumise, et, ivres d'esclavage, elles mouraient d'amour avant
d'avoir aimé.
Par les villes et dans les châteaux, et jusque parmi les bergères,
on n'entendait plus que ce cri des énamourées: «O ma chère! ô ma
chair! Il est irrésistible!»
III
ALBERT SAMAIN.
ebookgate.com