[Copyright Information] [Table of Contents] [Que Home Page]
[Prev Chapter] [Next Chapter]

06 - Installing and Understanding Microsoft SQL Server

The installation of SQL Server is relatively simple and similar to the installation of other Microsoft products. In this appendix, you'll receive information about the different steps and considerations to keep in mind as you set up your server system. Here's an example of the topics that will be covered:


The information in this appendix comes from Que Publishing's "Special Edition, Using SQL Server" that contains complete coverage of SQL Server, replication, administration and the SQL language.

Understanding Server Hardware and Software Requirements

The computer system for your SQL Server installation should be on the list of supported Windows NT systems. If your system is an Intel x86-based processor, it should be 33 MHz or faster, according to Microsoft Documentation. In practice, it's not recommended that you implement SQL Server in a production environment on anything less than a Pentium 75mhz with 32M of RAM.

Also according to the documentation, you must have a minimum of 16M of RAM, although additional memory is recommended for x86-based systems. A minimum of 16M is suggested for a Windows NT Server system, but 32M is more appropriate. Most RISC-based systems are usually configured with a minimum of 64M and often are configured with 128M of memory.


These stated minimums are just that: minimums. As you bring up systems, there are a number of factors that will impact these numbers. Be sure to pay special attention to any Replication tasks you may wish to run, and to the number of client systems that you'll be allowing to access the server during peak periods.

One of the biggest performance boosts you can offer in the SQL Server world is the addition of memory. This simple enhancement can improve performance by two-fold or more in many cases.

These recommendations aren't unreasonable for a server system. Don't forget how inexpensive memory has become in recent years. In 1977, approximately 250k of memory for at least one manufacturer's system was priced at $17,000. In recent years, you can buy 1M of memory for less than $50.

Although you may be using an Intel x86-based processor in your server system, its processing power and speed far exceeds the large minicomputer systems of 10 to 15 years ago. Don't be deceived by the physical difference in size with your system vs. a mainframe.

You need to have at least 70M of disk space to complete the installation, and if you install the books on-line feature of SQL Server, you'll need to add 15M to this requirement. However, if you have only 70M, you don't have any space to create additional logical devices on which to create your databases. You should count on a minimal SQL Server installation requiring approximately 150M to start.

Note that, although you can create your database tables and other objects within the master database, you shouldn't. Try to keep your core objects, those installed when you first bring up SQL Server, on a common logical device. As you'll see later, when you create additional devices, databases and tables, you can designate different storage devices for those, if your primary location does not have the disk space available. You also need a floppy-disk drive for 3 1/2-inch, high-density disks or a CD-ROM drive to read the installation media.

Load the SQL Server software from your installation media onto a Microsoft Windows NT workstation or Windows NT Server system. You don't need any additional network software because the Windows NT system contains built-in network software. You need a network interface card (NIC) that's supported by Windows NT. If you'll access SQL Server directly only from the server system, without using a network for access, you don't need a NIC.

You can install SQL Server on a partition that uses either the FAT or NTFS file systems. You'll probably want to take advantage of the recovery and security features of a NTFS disk partition rather than the older and simpler FAT disk system, although your installation may have other considerations for other installed software that dictate this installation parameter.

Running Setup

Installing Microsoft SQL Server for Windows NT is remarkably simple. The installation is similar to the installation of nearly all Microsoft Windows products, and it will appear familiar to you if you've installed a Windows application. You must run the setup program using an NT account that has Administrative privileges, such as the NT Administrator account.

To perform the installation, follow these steps:

  1. Choose Run from the Start menu.

  2. Type the drive letter of your floppy or CD drive, followed by setup in the run combo list box.

  3. displays one or more message boxes after checking whether you're working from an Administrative account and whether SQL Server already is installed. Figure 6.1 shows the Welcome dialog box that appears when the SQL Server setup program is invoked.

    Fig. 6.1 - You can change a characteristic such as the security mode only by running SQL Setup.

  4. Click Continue.

  5. Enter a Name, Company, and Product ID in the Enter Name and Organization dialog box. Then click Continue.

  6. A second dialog box appears, asking you to confirm the name and company. If you want to change the name, click Change. Otherwise, click Continue.

  7. The Microsoft SQL Server 6.5 - Options dialog box appears. The Install SQL Server and Utilities option is automatically selected.

  8. install SQL Server, only the Install SQL Server and Utilities, Upgrade SQL Server, and Install Utilities Only options are available. Install SQL Server and Utilities installs all the SQL Server software, including the 32-bit version of the client utilities on the server. Click Continue.

  9. In the Choose Licensing Mode dialog box, you must enter the way in which you've bought licenses for the use of SQL Server, as well as the number of clients that may connect to the server. Figure 6.2 shows the entry of a server-based license that will permit a maximum of 20 connections. After you click Continue, an additional dialog box appears that requires you to confirm that you've bought the number of client licenses that you've entered.

    Fig. 6.2 - Client licensing permits you to buy the exact number of client connections that you need.

  10. In the SQL Server Installation Path dialog box that appears, confirm or change the drive and directory path for SQL Server files and click Continue. Drive C is the default.

  11. The MASTER Device Creation dialog box that appears allows you to confirm or change the entries for the MASTER device drive, directory, and the size of the master device.

  12. of 25M for the MASTER Device Size may be inadequate. If you anticipate creating many devices, databases, or other objects, you can initially allocate a master device of perhaps 40M to 60M.

  13. contains the master database and transaction log, which holds several system tables. You should avoid creating any objects in the master database, unless you want the objects to be available throughout the server system to all databases. Rows are added to the system tables by SQL Server to reference objects that you create. Click Continue to go on to the next step.

  14. The SQL Server Books On-line dialog box appears, allowing you to define whether you want to install the on-line documentation to run from the hard disk or the CD (see fig. 6.3). You should install the documentation on a hard drive of the server, unless you're short on disk space as this improves the access time to the information.

    Fig. 6.3 - You can share the on-line documentation from the server, saving disk space on the client systems. You can also install copies on client systems.

  15. The Installation Options dialog box appears, enabling you to define the Character Set, Sort Order, and Additional Network Support (see fig. 6.4). Click Sets.

    Fig. 6.4 - Select Auto Start SQL Server at Boot Time to automatically start SQL Server, and Auto Start SQL Executive at Boot Time to automatically start SQL Server when the Windows NT server system is booted.


    If you use an administrator's account and password for the NT Executive configuration, and later change the password for that account, be sure to return to the Services applet in the Control Panel to update the information for NT Executive's logon. If you don't, the service will be unable to start and will not perform as needed.

  16. In the Select Character Set dialog box, select a language. If you're working only in English, you can choose 437 US English in the Select Character Set list box. If you're working in another language or storing information in multiple languages, you should select 850 Multilingual or ISO Character Set (Default). Click OK.

  17. You're returned to the Installation Options dialog box. Click Orders.

  18. In the Sort Order list box, confirm the default sort order or change it. If, for example, you select Binary Order, Order By clauses in Select statements are sorted by the direct binary representation of the column values. You can also select Dictionary Order, Case-Insensitive (the default) to treat corresponding upper- and lowercase letters as identical values.


    If you later must change your character set or sort order, you'll have to rebuild the master database.

  19. Click OK. You're again returned to the Installation Options dialog box. Click Networks.

  20. You can install additional Net-Libraries to Named Pipes in the Select Network Protocols dialog box. For example, you can enter one or more additional Net-Libraries, such as the IPX/SPX or TCP/IP communication mechanisms. If you don't select additional Net-Libraries during installation, you can install them later.


    If you have the desktop version of Microsoft SQL Server, you can't select alternate Net-Libraries; only Named Pipes may be installed.

  21. Click OK to return to the Installation Options dialog box.

  22. Click Continue. Enter a Windows NT account and password to be used by SQL Executive Service in the SQL Executive Log On Account dialog box (see fig. 6.5).

    Fig. 6.5 - You should enter a password for the SQL Executive Service account that contains at least eight characters.


    It's a good idea to use a separate NT account for this service rather than share the NT Administrator account. If you later change the NT Administrator account without realizing it's being used by SQL Executive Service, SQL Server may not work correctly.

  23. Click Continue. A File Copy in Progress dialog box appears, showing the progress of server files as they're copied from the distribution. As the installation proceeds, additional feedback is displayed on your monitor telling you that SQL Server is installing SQL Server.

If you successfully install SQL Server from a CD, you won't see any more dialog boxes. If you install SQL Server from floppy disks, you'll be prompted to change disks. When the installation is completed successfully, click Reboot if you want to begin using SQL Server.


Remember to manually start the SQL Server services after you reboot if you haven't defined automatic SQL Server startup.

Starting the Server

You have several options available for starting SQL Server on the system. You can configure the SQL Server services system to start automatically each time the Windows NT server system is booted. You also can use the SQL Service Manager to start the SQL Server services. Several Windows application tools can optionally start SQL Server when the applications try to connect to the server. Finally, the server can be started using a command line.

Using Automatic Service Startup

You can enable the automatic startup of SQL Server each time the Windows NT system is started. To start up SQL Server each time the server is booted, select the Auto Start SQL Server at Boot Time check box in the Installation Options dialog box (refer back to figure 6.4). You also can define an automatic startup for SQL Server after installation.

If you don't define SQL Server processes to automatically start up, you can later change it to automatic by using the Control Panel's Services option.

  1. Open the Control Panel.

  2. Double-click Services.

  3. In the Services dialog box, scroll down the Service list box to find MSSQLServer.

  4. Select MSSQLServer. The Startup should be Manual. A manual service isn't automatically started.

  5. Click Startup to open the Service dialog box (see fig. 6.6).

    Fig. 6.6 - Set up SQL Server to log on with a specific user account..

  6. In the Startup Type section, select Automatic.

  7. specify that the MSSQLServer process created by the automatic startup of the service use an account other than the Administrator system account. If you use another account, you must specify the Password Never Expires characteristic in the NT Server's User Manager utility. You don't need to specify a different account from the system account for SQL Server.


    It's very important that you consider your future uses for SQL Server as you install it concerning user identities for the SQL processes. If you're using, or will be using in the future, the email capabilities of SQL Server, and the post office resides on a Novell server, you won't be able to access the mail system unless you establish a separate account for SQL Server.

  8. Click OK in the Service dialog box. The MSSQLServer Startup column should have changed from Manual to Automatic.

  9. If you want to immediately start SQL Server, click Start. A message box appears, telling you that SQL Server is starting. If the SQL Server service is successfully started, Started is added in the Status column of the Services dialog box for the SQL Server service.

  10. Click Close.

Starting SQL Server with SQL Service Manager

You can use the SQL Service Manager to start MSSQLServer on the Windows NT server system. To start MSSQLServer by using the SQL Service Manager, follow these steps:

  1. Click the SQL Service Manager icon in the SQL Server for Windows NT group

  2. Click Start/Continue or click the green light

  3. at the bottom of the SQL Service Manager dialog box should change from The service is stopped to The service is starting. After SQL Server is started, the message changes to The service is running.

  4. Either Close the SQL Service Manager or minimize it to an icon.

If you leave the SQL Server Service Manager running, you can easily Stop or Pause SQL Server as needed.

Starting SQL Server Through Windows Applications

You can optionally start up SQL Server when you connect to the server locally from the server or remotely from a client system. For example, a miniature version of the SQL Service Manager can be invoked from the toolbar of the SQL Enterprise Manager, allowing you to start and stop the server engine.

Starting SQL Server Through a Command Line

To start up SQL Server using a command line, follow these steps:

  1. Open a command prompt.

  2. At the command prompt, enter this command line:
    sqlservr /d drive:\directory\data\master.dat

Use /d to specify the name of the SQL Server master database.

The drive is the drive letter you entered in the Drive text box of the SQL Server Installation Path dialog box (refer back to fig.). The directory is the directory you entered in the Directory text box of the same dialog box. The default for the directory is SQL and the default for the drive is C.

Master.dat is the name of the data file that is the SQL Server master device. The master database is located on the master device and contains the set of system tables that defines SQL Server. Master.dat is located in the subdirectory data of the SQL directory.


The sqlservr command line actually starts two system processes, both of which can have multiple threads.

Installing the Client Software

Many of the SQL Server utilities that you use to manage the server, issue queries against it and develop and debug your applications, are available not only as server-based applications, but also client side applications. The utilities installed will vary depending on the client environment you are installing into. If you're using a 16bit client, for instance Windows for Workgroups, you'll have fewer options installed than if you're using a 32bit environment like Windows 95 or Windows NT.

For the 16bit Windows clients, the following utilities are installed:

For the 32bit client, the following utilities are installed:

Steps to Installing the Software--32bit Client

If you're installing the software on a 32bit client such as Windows 95 or Windows NT, you can take advantage of the added utilities mentioned earlier. To start setup, select the processor subdirectory on the CD that corresponds to your system. It's most likely that you'll be installing using the i386 subdirectory as this corresponds to the 32bit installation of the utilities.

Here are the steps to installing the software:


To avoid conflicts with system files, you should exit all other software applications prior to running the setup program. If you don't, you may receive an error message as the files are copied to your system. This error message will prevent you from completing the installation successfully. Pay special attention to less-obvious applications such as the Office toolbar or other applications that run in the background. When in doubt, use the Windows task manager to verify the processes that are active on your system.

Once completed, you'll be able to use the client workstation to administer, inquire into and manage the different aspects of your SQL Server system.

Installing the Software--16bit Client

As mentioned earlier, the 16bit client software offers somewhat less, although just as useful, utilities for your SQL Server installation. When you install the software on your system, you'll be following similar prompts as other Windows installations you may have completed.

The first step is to select the Clients subdirectory from the CD containing SQL Server. Select your operating system, either DOS or Win16 for the 16bit Windows client software. If you're running the Windows setup, select and run the SETUP program, installation of the DOS client software simply requires copying the files to a directory of your choice.

The Windows setup program will prompt you for the destination of the files and will then ask you to confirm which utilities you want to install.

When you select Install, the utilities will be copied to your system. A program group will be created and you'll be ready to start using the utilities with your system.

Obtaining Transact--SQL Help

You can obtain help when you're performing operations through any ISQL query window. You may need the most help with Transact-SQL syntax. A system-stored procedure called sp_helpsql provides help with the syntax of Transact-SQL statements, system procedures, and other topics from within the ISQL command-line utility. The syntax of sp_helpsql is

sp_helpsql ['topic']
Although the topic is optional (as indicated by the square brackets, which you shouldn't type as part of the procedure line), enclose it in single quotation marks to return information on the specified topic. If you use sql_helpsql without a topic, it returns help on the use of the help procedure.

You can use sp_helpsql to return information about data definition commands that create database objects. In the following example, the sp_helpsql procedure returns information about the CREATE TABLE statement.

sp_helpsql 'create table'
helptext
-----------------------------
CREATE TABLE
Creates a table.

   CREATE TABLE [[<database.>]<owner.>]
    <table_name>
     (<column_name> <datatype> [NOT NULL | NULL]
       [, <column_name> <datatype>
     [NOT NULL | NULL]]...)
       [ON <segment_name>]

The information about using the CREATE TABLE command and other information returned with the system-stored procedure is returned in tabular format with a column header. This is because it's retrieved from a system table within SQL Server. The sp_helpsql system procedure uses a Select statement to retrieve help information.

The following example displays help for using a system-stored procedure. The help returned includes a description of the procedure's function and syntax. Help on stored procedures is quite useful because you pass information to a procedure such as sp_bindrule as parameters.

sp_helpsql sp_bindrule
helptext
-----------------------------
sp_bindrule
Binds a rule to a column or user datatype.

   sp_bindrule <rule_name>, <objname> [, FUTUREONLY]

Items enclosed in angle brackets "<" and ">" are parameters that you must provide with the command. Items within square brackets, "[" and "]", are optional.

To run a stored procedure, enter the name of the stored procedure, a space, and then any applicable parameters. Each parameter should be separated by commas. When you can't remember the procedure syntax, use sp_helpsql to show the order and information required for each parameter of a function.

If you return help about the functions topic, you'll see general information about functions as well as a list of the function groups for which information is available. For example, you can issue the statement shown in the following example to find out more about FUNCTIONS supported by SQL Server.

sp_helpsql functions
The keyword FUNCTIONS returns special information from the database. Functions are used in Select statements and are divided into aggregate, date, mathematical, string, system, text/image, and type-conversion functions. Each group is described separately within the on-line help. Help is available for the following function groups:

AGGREGATE    DATE    MATH    STRING    SYSTEM
    TEXT    CONVERSION
If you don't already know the name of a specific function for which you want help, you must first enter the name of one of the function groups as the parameter to the SP_HELPSQL statement. For example, the command sp_helpsql 'date functions' shows a list of the functions for which help is available.

The sp_helpsql help function doesn't accept subtopics and topics. You can't enter a topic such as the name of a function group and the function name to obtain help on a specific function. Enter the name of a function as a topic after you find its name. In the following example, information is returned about the getdate function after its name is found with the separate command sp_helpsql 'date functions':

sp_helpsql 'getdate'
helptext
-----------------------------
GETDATE
GETDATE returns the current date and time in SQL Server's standard internal format for date/time values. GETDATE takes the NULL parameter ().

You can also enter fragments of keywords used to form Transact-SQL statements as part of the SP_HELPSQL statement. You can use a keyword fragment to obtain help when you don't know an entire command or when you're unsure of the keyword spelling. In the following example, cre is entered to return information on create statements or any other Transact-SQL keywords that begin with cre:

sp_helpsql 'cre'
In the preceding example, you've entered a non-unique topic. You can obtain more information for the following topics:

command
------------------------------
create rule
create view
create index
create table
create default
create trigger
create database
create procedure
The last example of an sp_helpsql command shows information that you may want to view when you create a table. Help on the datatype topic returns information about all Transact-SQL datatypes, including a brief description of data the datatype can store and the range of values.

sp_helpsql 'datatype'
helptext
-----------------------------
Datatype                  Definition

Binary(n)                 Fixed-length binary data.
                          Maximum length=255 bytes.

Bit                       A column that holds either
                          0 or 1.

Char(n)                   Character data. 
                          Maximum length=255 bytes.

Datetime                  Dates and times with accuracy
                          to milliseconds.

Float                     Floating-point numbers.

Image                     Large amounts of binary data
                          (up to 2,147,483,647
                          characters.)

Int                       Integers between 
                          2,147,483,647 and
                          -2,147,483,648.

Money                     Dollar and cent values.

Real                      Floating point numbers with
                          7-digit precision.

Smalldatetime             Dates and times with 
                          accuracy to the minute.

Smallint                  Integers between 32,767 
                          and -32,768.

Smallmoney                Monetary values between
                          214,748.3647 and
                          -214,748.3648.

Text                      Large amounts of character 
                          data (up to
                          2,147,483,647 characters.)

Timestamp                 Automatically updated when you
                          insert or update a row that 
                          has a timestamp
                          column, or use BROWSE mode in a
                          DB-LIBRARY application.

Tinyint                   Whole integers between 0 
                          and 255.

Varbinary(n)              Variable-length binary data.
                          Max length=255 bytes.

Varchar(n)                Variable-length character data.
                          Max length=255 bytes. 

From Here...

Now that you've installed SQL Server, you can set up the System DSN data sources that IIS can put to use on your pages. Be sure to experiment with the Web Page Wizard for SQL Server as well. For more information about database access, see Chapter 11, "Building Databases for Intranet Access."


Copyright © 1996, Que Corporation
Technical support for our books and software is available by email from
support@mcp.com

Copyright ©1996, Que Corporation. All rights reserved. No part of this book may be used or reproduced in any form or by any means, or stored in a database or retrieval system without prior written permission of the publisher except in the case of brief quotations embodied in critical articles and reviews. Making copies of any part of this book for any purpose other than your own personal use is a violation of United States copyright laws. For information, address Que Corporation, 201 West 103rd Street, Indianapolis, IN 46290.

Notice: This material is from BackOffice Intranet Kit, ISBN: 0-7897-0848-5. The electronic version of this material has not been through the final proof reading stage that the book goes through before being published in printed form. Some errors may exist here that are corrected before the book is published. This material is provided "as is" without any warranty of any kind.

[Copyright Information] [Table of Contents] [Que Home Page]
[Prev Chapter] [Next Chapter]