Microsoft SQL Server 2000 Programming Step by Step

( 4 )

Overview

With scalability for the most demanding applications, Microsoft® SQL Server™ 2000 can dramatically reduce the time needed to bring e-commerce, data warehousing, and line-of-business applications to market. Whether you’re new to databases or familiar with Microsoft Access, Oracle, and other relational databases, MICROSOFT SQL SERVER 2000 PROGRAMMING STEP BY STEP is the ideal way to learn how SQL Server can work for you. Written by an experienced database developer and author and replete with examples and ...

See more details below
Available through our Marketplace sellers.
Other sellers (Paperback)
  • All (24) from $1.99   
  • New (4) from $5.30   
  • Used (20) from $1.99   
Close
Sort by
Page 1 of 1
Showing All
Note: Marketplace items are not eligible for any BN.com coupons and promotions
$5.30
Seller since 2009

Feedback rating:

(316)

Condition:

New — never opened or used in original packaging.

Like New — packaging may have been opened. A "Like New" item is suitable to give as a gift.

Very Good — may have minor signs of wear on packaging but item works perfectly and has no damage.

Good — item is in good condition but packaging may have signs of shelf wear/aging or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Acceptable — item is in working order but may show signs of wear such as scratches or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Used — An item that has been opened and may show signs of wear. All specific defects should be noted in the Comments section associated with each item.

Refurbished — A used item that has been renewed or updated and verified to be in proper working condition. Not necessarily completed by the original manufacturer.

New
Brand new item. Sealed CD included. Perfect condition.

Ships from: Edmonds, WA

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
$26.39
Seller since 2008

Feedback rating:

(171)

Condition: New
0735611424 BRAND NEW NEVER USED IN STOCK 125,000+ HAPPY CUSTOMERS SHIP EVERY DAY WITH FREE TRACKING NUMBER

Ships from: fallbrook, CA

Usually ships in 1-2 business days

  • Standard, 48 States
  • Standard (AK, HI)
$45.00
Seller since 2014

Feedback rating:

(187)

Condition: New
Brand new.

Ships from: acton, MA

Usually ships in 1-2 business days

  • Standard, 48 States
  • Standard (AK, HI)
$45.00
Seller since 2014

Feedback rating:

(187)

Condition: New
Brand new.

Ships from: acton, MA

Usually ships in 1-2 business days

  • Standard, 48 States
  • Standard (AK, HI)
Page 1 of 1
Showing All
Close
Sort by
Sending request ...

Overview

With scalability for the most demanding applications, Microsoft® SQL Server™ 2000 can dramatically reduce the time needed to bring e-commerce, data warehousing, and line-of-business applications to market. Whether you’re new to databases or familiar with Microsoft Access, Oracle, and other relational databases, MICROSOFT SQL SERVER 2000 PROGRAMMING STEP BY STEP is the ideal way to learn how SQL Server can work for you. Written by an experienced database developer and author and replete with examples and exercises, this book will help you quickly get up to speed with creating and maintaining databases using the interactive tools provided by SQL Server 2000 Personal, Standard, and Enterprise Editions. It’s a must-have resource for anyone who wants to create and maintain databases and program with Transact-SQL.

This title shows you how to: Get started with SQL Server:

  • Use the Enterprise Manager to connect to a database; start, stop, and pause SQL Server
  • Back up and restore a database and use the Maintenance Plan Wizard to create a monthly backup plan and manage SQL Server security functions.
  • Create a SQL database: Create and manage databases, tables, indexes, relationships, constraints, table objects, and database diagrams.
  • Retrieve data: Retrieve rows, use the SELECT statement, join tables and summarize data, and view data in a variety of ways.
  • Work with data: Add, delete, and update rows, and import and export data.
  • Use the Transact-SQL programming language: Understand operators, variables, parameters, and control of flow
  • Use stored procedures; create and manage triggers
  • Learn error handling

Included on CD-ROM!

Sample database files

Sample script code in Transact-SQL

A Note Regarding the CD or DVD

The print version of this book ships with a CD or DVD. For those customers purchasing one of the digital formats in which this book is available, we are pleased to offer the CD/DVD content as a free download via O'Reilly Media's Digital Distribution services. To download this content, please visit O'Reilly's web site, search for the title of this book to find its catalog page, and click on the link below the cover image (Examples, Companion Content, or Practice Files). Note that while we provide as much of the media content as we are able via free download, we are sometimes limited by licensing restrictions. Please direct any questions or concerns to booktech@oreilly.com.

Read More Show Less

Editorial Reviews

Booknews
Describes how to use the SQL server 2000 enterprise manager for creating and administering databases and database objects, and how to automate functionality with the query analyzer by using scripts, triggers, functions, and stored procedures. In a series of 30 lessons, the author covers security, indexes, check constraints, sorting rows, adding and deleting rows, copying and moving data, data definition language, the transact-SQL language components, programming objects, and cursors. The CD-ROM contains practice database files. Annotation c. Book News, Inc., Portland, OR (booknews.com)
Read More Show Less

Product Details

  • ISBN-13: 9780735611429
  • Publisher: Microsoft Press
  • Publication date: 11/28/2000
  • Series: Step by Step Developer Series
  • Edition description: 2000 Edition
  • Pages: 720
  • Product dimensions: 7.29 (w) x 9.12 (h) x 1.83 (d)

Meet the Author

With twenty years experience in the field, Rebecca M. Riordan has earned an international reputation for designing and implementing computer systems that are technically sound, reliable, and effectively meet her clients' needs. Her particular area of expertise is database design and she is a five year Access MVP. Rebecca has also authored several database books and served as a senior technical support engineer for Microsoft's database products. As a Microsoft employee in Australia, Rebecca was the Senior technical support engineer for Microsoft's database products.

Read More Show Less

Read an Excerpt

Lesson 21.The Query Analyzer
  • Understanding the Query Analyzer
    • Starting the Query Analyzer
    • Selecting a Database
  • Using the Query Window
    • Entering Transact-SQL Statements
    • Using SQL Scripts
  • Using the Object Browser
    • Opening Objects
    • Adding Objects to the Editor Pane
    • Scripting Objects

Lesson 21 The Query Analyzer

In this lesson you’ll learn how to:

  • Start the Query Analyzer.
  • Select a database with which to work.
  • Execute Transact-SQL statements in the Query window.
  • Create SQL Scripts.
  • Open objects from the Object Browser.
  • Add objects to the Editor Pane from the Object Browser.
  • Script objects from the Object Browser.

In the previous lessons, we’ve used the Enterprise Manager to create and maintain database objects and to perform basic data operations. In this lesson, we’ll look at another one of Microsoft SQL Server’s graphical tools—the Query Analyzer.

Understanding the Query Analyzer

Although it’s possible to create and execute queries and other Transact-SQL statements in the Enterprise Manager, its greatest strength is as a tool for database administration. The Query Analyzer, on the other hand, is primarily a programming tool.

The Query Analyzer provides you with powerful tools for writing and debugging complex sets of Transact-SQL statements in various forms. (We’ll look at one of these, SQL scripts, in this lesson.) It also provides the means to analyze the performance of queries via execution plans and the Index Tuning Wizard, as we’ll see in Lesson 23.

Starting the Query Analyzer

You can start the Query Analyzer from within the Enterprise Manager or from the Windows Start menu. When you start the Query Analyzer from the Enterprise Manager, the Query Analyzer will transfer the connection information from the Enterprise Manager: if you are connected to a server, the Query Analyzer will connect to that server, and if you have a database selected, the Query Analyzer will select that database.


TIP:
You can use the isqlw command from the command prompt as a third way to start the Query Analyzer.

If you start the Query Analyzer from the Start menu, or if you haven’t made a server or database connection in the Enterprise Manager, you must make the connection manually from within the Query Analyzer.

Start the Query Analyzer from the Enterprise Manager

  1. Navigate to the Aromatherapy database in the Console Tree in the Enterprise Manager.
  2. SQL Server displays a list of database objects in the Details Pane.

    (Image Unavailable)

  3. Select SQL Query Analyzer from the Tools menu.
  4. SQL Server opens the Query Analyzer, automatically connecting to the server and the Aromatherapy database.

    (Image Unavailable)


    NOTE:
    If you don’t see the Object Browser in the Query Analyzer, press F8 to display it.
  5. Close the Query Analyzer.

Start the Query Analyzer from the Start menu

  1. On the taskbar, click the Start button.
  2. Point to Programs, and then select the Microsoft SQL Server folder.
  3. The icons in the Microsoft SQL Server folder appear in a list.

  4. Click the Query Analyzer program icon.
  5. Query Analyzer icon (Image Unavailable)

    The Query Analyzer displays the Connect to SQL Server dialog box.

    (Image Unavailable)

  6. Make sure the correct server and authentication mode are selected, and click OK.
  7. The Query Analyzer connects to the server, and then opens. The Query Analyzer will connect to whichever database has been selected as the default for your login.


    TIP:
    If your server isn’t set to start automatically, you can use the Start SQL Server If It Is Stopped check box to automatically start the server when you connect.

    (Image Unavailable)

Selecting a Database

The Query Analyzer will use the currently selected database to resolve references in queries and other Transact-SQL statements. Its toolbar, shown in Figure 21-1, contains a combo box showing the database that is currently selected. You can switch to a different database by selecting its name in the toolbar or from the Query menu.

Figure 21-1. The Query Analyzer toolbar displays the currently selected database. (Image unavailable)

Selecting a database using the toolbar

  1. Select Northwind in the toolbar combo box.
  2. (Image Unavailable)

Select a database from the Query menu

  1. Select Change Database in the Query menu.
  2. The Query Analyzer displays the Select Database dialog box.

    (Image Unavailable)


    TIP:
    You can also use the shortcut key Ctrl-U to open the Select Database dialog box.
  3. Select the Aromatherapy database by clicking anywhere in that row.
  4. (Image Unavailable)

  5. Click OK.
  6. The Query Analyzer selects the Aromatherapy database.

Using the Query Window

The Query Analyzer initially displays two windows, the Object Browser and the Query window. When you first open the Query Analyzer, a single Query window is opened, but you can open a new window at any time by clicking the New Query button on the Query Analyzer toolbar.

New Query button (Image Unavailable)

The Query window displays the name of the database server, the current database, the current login, and the query name in the title bar. The Query window is similar to the Enterprise Manager’s Query Designer but is much more powerful.

As an editor, the Query window is more flexible and powerful than the Query Designer’s SQL Pane. While the Query Designer can process only a limited set of SQL statements, the Query window can process any valid Transact-SQL statement, and you can enter multiple statements for processing in a single batch.

Although the Query window doesn’t support the Grid or Diagram views available in the Query Designer, it supports additional views of a query that are used to analyze performance, as we’ll see in Lesson 23.

The Query window also gives you the option of displaying each view of the query in a separate tab, rather than as panes. This is often the most convenient way of viewing the query.

Entering Transact-SQL Statements

The simplest way to use the Query window is to type in an SQL statement, just as you would in the SQL Pane of the Query Designer. Unlike the Query Designer, however, the Query Analyzer’s Query window provides some extra assistance by color coding the Transact-SQL statements you enter. Table 21-1 shows the colors the Query window uses.

Color Meaning
Blue Keyword
Dark Green Comment
Dark Red Stored Procedure
Gray Operator
Green System Table
Magenta System Function
Red Character String

Table 21-1. Color coding used in the Query Analyzer’s Query window.

Execute a SELECT query

  1. Enter the following SELECT statement in the Query window:
  2. SELECT OilID, OilName, LEFT(LatinName, 10)
    FROM Oils
  3. The Query window changes the color of the text as you type.
  4. (Image Unavailable)

  5. Click the Execute Query button on the Query Analyzer toolbar.
  6. Execute Query button (Image Unavailable)

    The Query Analyzer adds a pane to the Query window containing two tabs: the Grids tab, which contains the query results, and the Messages tab.

    (Image Unavailable)

  7. Select the Messages tab.
  8. The Query window displays the messages generated by the query.

    (Image Unavailable)

Display query results in a separate tab

  1. Select Options from the Query Analyzer’s Tools menu.
  2. The Query Analyzer displays the Options dialog box.

    (Image Unavailable)

  3. Select the Editor tab.
  4. (Image Unavailable)

  5. Select the check box labeled Tabbed Mode (Vs. Splitter Mode).
  6. (Image Unavailable)

  7. Click OK.
  8. The Query Analyzer changes the display of the Query window.

    (Image Unavailable)

Using SQL Scripts

A script is a set of Transact-SQL statements stored in a file. Scripts are most often used to keep a permanent record of the commands used to create and populate database objects. Because the scripts are stored in text files, rather than in the database, they can be used to re-create the database on different servers. (SQL Server actually uses scripts to create the Pubs and Northwind sample databases.)

Although scripts are most often used for creating database objects, they’re not limited to this use. Any valid Transact-SQL statement can be included in a script.

The SQL statements in a script are grouped into batches. A script can contain one or more batches, and each batch can contain one or more SQL statements. In a script containing more than one batch, the batches are separated by the GO command. If a script doesn’t contain the GO command, all the statements will be executed as a single batch.

Create a script

  1. Change the SQL statement in the Query window to read:
  2. SELECT OilID, OilName, LEFT(LatinName, 10)
    FROM Oils
    GO
    SELECT PlantPartID, PlantPart
    FROM PlantParts

    TIP:
    Only the last three lines have been added to the query used in the previous exercise.
  3. Click the Execute Query button on the Query Analyzer toolbar.
  4. The Query Analyzer displays the results in two panes of the Grids tab of the Query window.

    (Image Unavailable)

  5. Reselect the Editor tab of the Query window, and click the Save button on the Query Analyzer toolbar.
  6. Save button (Image unavailable)

    The Query Analyzer displays the Save Query dialog box.

    (Image Unavailable)


    IMPORTANT:
    If you don’t select the Editor tab before clicking the Save button, the Query Analyzer will save the result of the query, rather than the query itself.
  7. Navigate to the SQL 2000 Step by Step folder in the root directory, and name the script Lesson21.
  8. (Image Unavailable)

  9. Click Save.
  10. The Query Analyzer saves the new script file.

Open a script

  1. Click the New Query button on the Query Analyzer toolbar.
  2. New Query button (Image unavailable)

    The Query Analyzer opens a new, empty Query window.

    (Image Unavailable)

  3. Click the Open button on the Query Analyzer toolbar.
  4. Open button (Image unavailable)

    The Query Analyzer displays the Open Query File dialog box.

    (Image Unavailable)

  5. Navigate to the SQL 2000 Step by Step folder in the root directory, and select Lesson 21.
  6. (Image Unavailable)

  7. Click Open.
  8. The Query Analyzer displays the script in the Query window.

    (Image Unavailable)

  9. Click the Execute Query button on the Query Analyzer toolbar to run the script.
  10. Execute Query button (Image unavailable)

    The Query Analyzer displays the results in the Grids tab.

    (Image Unavailable)

  11. Close the script window.

Using the Object Browser

The Object Browser is contained in the pane on the left side of the Query Analyzer window. Just as the Console Tree of the Enterprise Manager provides a hierarchical view of the objects in a SQL Server installation, the Objects tab of the Object Browser displays a hierarchical view of the databases in the server to which you’re connected, as well as other common objects used in creating Transact-SQL programs.


TIP:
The Templates tab of the Object Browser contains a hierarchical view of the available programming templates. We’ll look at templates in the next lesson.

The Objects tab of the Object Browser is arranged somewhat differently from the Console Tree in the Enterprise Manager. Only database objects are listed, so items such as Logins and Data Transformation Services packages aren’t visible. Also, the tables in a database are divided into two folders for convenience: User Tables and System Tables.

Additionally, rather than simply listing the tables in a database the way the Enterprise Manager Console Tree does, the Object Browser displays the columns, indexes, constraints, and triggers that you’ve defined for the table, as well as the dependencies, the views, and the tables that depend on the table. Figure 21-2 shows the Object Browser display for the Oils table.

Figure 21-2. The Object Browser displays information about the tables in your database that’s useful from a programming perspective. (Image unavailable)

The Common Objects folder of the Object Browser contains, along with the built-in data types, a set of common Transact-SQL functions grouped into categories. For each function, the Parameters folder contains a description of each parameter, including its name and data types. Figure 21–3 shows the LEFT function as it is displayed in the Object Browser window.

(Image unavailable)

Figure 21-3. The Object Browser displays functions by categories in the Common Objects folder.

Using the Object Browser, you can open a table or view, similar to the way you display rows by opening the Query Designer in the Enterprise Manager. Having done so, you can simply view the rows, or you can insert new rows and edit existing ones.

You can also use the Object Browser when you’re creating Transact-SQL programs. You can add objects to the Query window using drag-and-drop, and you can create several different kinds of scripts automatically from the context menu.

Opening Objects

When you right-click a table or view in the Object Browser and select Open, the Query Analyzer displays the rows in the table (or the results of the view’s SELECT statement) in the Open Table window.

Open a table

  1. Expand the User Tables folder of the Aromatherapy database in the Object Browser.
  2. The Query Analyzer displays a list of tables in the database.

    (Image Unavailable)

  3. Right-click dbo.PlantParts, and select Open.
  4. The Query Analyzer displays the rows in the table in an Open Table window.

    (Image Unavailable)

  5. When you’ve finished viewing the rows in the table, close the Open Table window.

Open a view

  1. Expand the Views folder of the Aromatherapy database in the Object Brower.
  2. The Query Analyzer displays a list of all views in the database.

    (Image Unavailable)

  3. Right-click dbo.OilCautionsExtended, and select Open.
  4. The Query Analyzer displays the rows returned by the query in an Open Table window.

    (Image Unavailable)

  5. When you’ve finished viewing the rows in the table, close the Open Table window.

Adding Objects to the Editor Pane

One of the simplest and most convenient capabilities of the Object Browser is its support for drag-and-drop. Whenever you need to specify an object listed in the Object Browser, simply drag it into position in the Editor Pane of the Query window, and its name will be pasted into the editor window.


TIP:
If you drag-and-drop one of the functions listed in the Common Objects folders, the Object Browser will paste the function’s name, but not its parameters. To paste the function’s complete syntax, use the Scripting command described in the next section.

Add a database object

  1. Select the Query window, make sure the Editor tab is selected, and then click the Clear Window button on the Query Analyzer toolbar.
  2. Clear Window button (Image unavailable)

    The Query Analyzer empties the Editor Pane.

  3. Type the following SQL statement into the Editor Pane (be sure to put a space after the final FROM):
  4. SELECT *
    FROM
  5. Expand the User Tables folder in the Object Browser.
  6. (Image Unavailable)

  7. Drag the dbo.Properties table from the Object Browser to the Editor Pane and drop it after the word FROM.
  8. The Query Analyzer pastes the table name into the statement.

    (Image Unavailable)

  9. Click the Execute Query button to execute the query.
  10. Execute Query button (Image unavailable)

    The Query Analyzer displays the results in the Grids Pane.

    (Image Unavailable)

Add all objects in a folder
  1. Reselect the Editor tab of the Query window.
  2. Delete the * from the SELECT statement.
  3. (Image Unavailable)

  4. Expand the dbo.Properties folder in the Object Browser.
  5. (Image Unavailable)

  6. Drag the Columns folder from the Object Browser to the Editor Pane and drop it after the word SELECT.
  7. The Query Analyzer pastes all the column names into the statement.

    (Image Unavailable)

  8. Click the Execute Query button on the Query Analyzer toolbar to execute the query.
  9. Execute Query button (Image unavailable)

    The Query Analyzer displays the results in the Grids pane.

    (Image Unavailable)

Scripting Objects

Scripting is a more sophisticated version of the drag-and-drop functionality of the Object Browser. Scripting creates a complete Transact-SQL statement and is available from the context menus of most objects. Not all script types are applicable to all object types, and some types, such as function parameters or columns, have no scripting available at all.

The available scripts and the objects to which they apply are shown in Table 21-2. We’ll be looking at most of these scripts in the next lesson about creating and maintaining database objects.

Script Command Applicable Objects
Create Table, Index, Constraint, Trigger, View, Stored Procedure
Alter Trigger, View
Drop Table, Index, Constraint, Trigger, View, Stored Procedure
Select Table, View
Insert Table, View
Update Table, View
Delete Table, View
Execute Stored Procedure, Function

Table 21-2. Scripting Options.

Scripts can be written to a new Query window, a script file, or the clipboard (where they can be pasted into an existing Query window). Some scripts, such as the function execution scripts, use replaceable parameters. The Query Analyzer provides a dialog box to make it easy to replace these parameters with the appropriate values.

Script a SELECT statement

  1. Expand the User Tables folder of the Aromatherapy database in the Object Browser.
  2. Right-click the dbo.OilProperties table, point to Script Object To New Window As, and choose Select.
  3. The Query Analyzer opens a new Query window with the SELECT statement.

    (Image Unavailable)


    TIP:
    The Object Browser creates the SELECT statement on a single line. You can reformat it to improve readability as shown in the illustration.
  4. Click the Execute Query button on the Query Analyzer toolbar to execute the query.
  5. Execute Query button (Image unavailable)

    The Query Analyzer displays the results in the Grids Pane.

    (Image Unavailable)

  6. When you’ve finished with the query, close the Query window.

Script a function

  1. Expand the String Functions folder within the Common Objects folder.
  2. (Image Unavailable)

  3. Right-click the LEFT function, point to Script Object To New Window As, and choose Execute.
  4. The Query Analyzer opens a new Query window with a SELECT statement, including the function.

    (Image Unavailable)

  5. Choose Replace Template Parameters from the Edit menu.
  6. The Query Analyzer opens the Replace Template Parameters dialog box.

    (Image Unavailable)

  7. Enter 'Test Expression' as the value for the character_expression parameter, and 4 as the value of the integer_expression parameter.
  8. (Image Unavailable)

  9. Click Replace All.
  10. The Query Analyzer replaces the parameters in the query.

    (Image Unavailable)

  11. Click the Execute Query button on the Query Analyzer toolbar to execute the query.
  12. Execute Query button (Image unavailable)

    The Query Analyzer displays the results in the Grids Pane.

    (Image Unavailable)

Lesson 21 Quick Reference

To Do this Button
Start the Query Analyzer Click the Start button on the task bar. Point to Programs and then to Microsoft SQL Server, and click Query Analyzer. (Image Unavailable)
Select a database with which to work Select the new database from the combo box on the Query Analyzer toolbar.  
Execute a Transact-SQL statement in the Query window Type the statement in the Editor Pane, and click the Execute Query button on the Query Analyzer toolbar. (Image Unavailable)
Create an SQL script Enter the Transact-SQL statements in the Query window, and click the Save button on the Query Analyzer toolbar. (Image Unavailable)
Load an SQL script Click the Open button on the Query Analyzer, and select the script in the Open Script dialog box. (Image Unavailable)
Open a table or view in the Object Browser Right-click the table or view in the Object Browser, and select Open.  
Add an object to the Editor Pane from the Object Browser Drag the object from the Object Browser, and drop it in the de- sired position in the Editor Pane.  
Script an object from the Object Browser Right-click the object in the Object Browser, point to Script Object to <destination> As, and select the type of script desired.  
Read More Show Less

Table of Contents

Introduction xvii
Part 1 Getting Started with SQL Server
Lesson 1 The SQL Server 2000 Environment 3
Understanding the Enterprise Manager 4
Starting the Enterprise Manager 5
Controlling SQL Server 6
Registering a Server 7
Starting and Stopping a Server 12
The Enterprise Manager Console Tree 13
The System Databases 14
Connecting to and Exiting a Database 16
Database Objects 16
Exiting the Enterprise Manager 17
Lesson 2 Administering SQL Server 19
Backing Up and Restoring Databases 20
Backing Up a Database 20
Restoring a Database 29
Using the Database Maintenance Plan Wizard 30
Lesson 3 SQL Server 2000 Security 41
Understanding Security Modes 42
Windows Authentication 42
SQL Server Authentication 42
User Logins 43
Creating User Logins 43
Managing Logins 56
Database-Level Security 60
Database Users 60
Database Roles 63
Part 2 Creating Databases
Lesson 4 Creating a Database 77
Creating Databases 77
Creating a New Database 78
Setting Database Properties 85
Managing Databases 88
Deleting a Database 88
Lesson 5 Creating Tables 91
Creating Tables 92
Understanding Data Types 93
Creating a New Table 95
Adding Columns to a Table 97
Managing Tables 107
Altering Columns 107
Altering Tables 110
Lesson 6 Creating Indexes 115
Understanding Indexes 116
Creating Indexes 116
Maintaining Indexes 131
Altering Indexes 131
Removing Indexes 135
Lesson 7 Creating Relationships 139
Understanding Relationships 139
Creating Relationships 142
Managing Relationships 146
Altering Relationships 146
Maintaining Relationships 149
Lesson 8 Creating Check Constraints 157
Understanding Check Constraints 157
Creating Check Constraints 158
Managing Check Constraints 161
Altering Check Constraints 161
Maintaining Check Constraints 163
Lesson 9 Creating Table Objects 169
Understanding Defaults 170
Creating Defaults 170
Understanding Rules 176
Creating Rules 176
Understanding User-Defined Data Types 181
Creating User-Defined Data Types 182
Lesson 10 Creating Database Diagrams 187
Understanding Database Diagrams 187
Creating a Database Diagram from an Existing Schema 188
Using Database Diagrams to Maintain the Database 196
Changing the Database Schema 196
Creating Database Objects 198
Part 3 Retrieving Data
Lesson 11 Retrieving Rows 207
Using the Query Designer 208
Viewing Rows in a Table 208
Updating Rows in a Table 210
Understanding the SQL Server Query Designer 213
The Diagram Pane 213
The Grid Pane 214
The SQL Pane 214
Lesson 12 The SELECT Statement 217
Understanding the SELECT Statement 218
Selecting All Columns 218
Selecting a Subset of Columns 220
Creating Column Aliases 223
Creating Calculated Columns 226
Using the TOP n Clause 231
Lesson 13 Sorting and Selecting Rows 235
The ORDER BY Clause 236
Sorting Rows 236
Sorting by Multiple Columns 240
The WHERE Clause 245
The Basic WHERE Clause 245
Using Special Operators 248
Combining Selection Criteria 252
Lesson 14 Joining Tables 257
Understanding the FROM Clause 258
Creating Joins 259
Inner Joins 260
Outer Joins 269
Unions 277
Lesson 15 Summarizing Data 281
Understanding SELECT DISTINCT 282
Using SELECT DISTINCT 282
Understanding GROUP BY 289
Using GROUP BY 289
Using the HAVING Clause 293
Lesson 16 Views 299
Understanding Views 299
Creating Views 300
Using Views 310
Managing Views 317
Altering Views 317
Removing Views 320
Part 4 Working with Data
Lesson 17 Adding Rows 325
Understanding the INSERT Statement 326
Using the INSERT statement 326
Inserting Rows Using the Grid Pane 326
Inserting Rows Using the SQL Pane 330
Inserting Multiple Rows 335
Lesson 18 Updating Rows 345
Understanding the UPDATE Statement 345
Using the UPDATE Statement 346
Updating Rows Using the Grid Pane 346
Updating Rows Using the SQL Pane 352
Updating Rows Using the FROM Clause 355
Lesson 19 Deleting Rows 359
Understanding the DELETE Statement 360
Using the DELETE Statement 361
Deleting Rows Using the Grid and Diagram Panes 361
Deleting Rows Using the SQL Pane 365
Using the TRUNCATE TABLE Statement 372
Deleting All Rows Using the TRUNCATE TABLE Statement 373
Lesson 20 Copying and Moving Data 377
The Data Transformation Services Wizards 377
Using the DTS Import Wizard 378
Using the DTS Export Wizard 388
Attaching and Detaching Databases 396
Detaching a Database 396
Attaching a Database 397
The Copy Database Wizard 399
Using the Copy Database Wizard 399
Part 5 Transact-SQL
Lesson 21 The Query Analyzer 409
Understanding the Query Analyzer 410
Starting the Query Analyzer 410
Selecting a Database 413
Using the Query Window 415
Entering Transact-SQL Statements 416
Using SQL Scripts 420
Using the Object Browser 425
Opening Objects 427
Adding Objects to the Editor Pane 430
Scripting Objects 434
Lesson 22 Data Definition Language 441
Understanding DDL 441
Creating Objects 442
Altering Objects 451
Dropping Objects 459
Using the Object Browser for Data Definition 463
Scripting DDL 463
Using Templates 465
Lesson 23 Analyzing Queries 471
Using the Query Analyzer to Optimize Performance 472
Execution Plans 472
Server Traces 479
Client Statistics 480
The Index Tuning Wizard 482
Using the Index Tuning Wizard 482
Lesson 24 Transact-SQL Language Components 491
Transact-SQL Commands 492
Data Manipulation Commands 494
Data Definition Commands 494
Database Administration Commands 495
Other Commands 496
Transact-SQL Operators 496
Operator Precedence 496
Comment Operators 497
Arithmetic Operators 498
Comparison Operators 501
Logical Operators 503
Bitwise Operators 505
Other Operators 507
Transact-SQL Functions 509
Using Functions 510
Date and Time Functions 510
Mathematical Functions 513
Aggregate Functions 516
Metadata Functions 519
Security Functions 521
String Functions 523
System Functions 526
Lesson 25 Programming Objects 529
Temporary Tables 530
Understanding Temporary Tables 530
Using Temporary Tables 531
Variables 542
Understanding Variables 542
Using Variables 546
Lesson 26 Controlling Execution 553
Conditional Processing 554
IF...ELSE 554
CASE 557
The GOTO Command 562
Looping 564
Simple WHILE loop 564
Complex WHILE Loops 566
Lesson 27 Transact-SQL Cursors 571
Understanding Cursors 572
Cursor Characteristics 573
Cursor Types 574
Using Cursors 576
Creating Cursors 576
Manipulating Rows with a Cursor 580
Updating and Deleting Rows with a Cursor 590
Monitoring Transact-SQL Cursors 592
Lesson 28 Stored Procedures 597
Understanding Stored Procedures 598
Exchanging Data with Stored Procedures 598
System Procedures 599
User-Defined Stored Procedures 600
Using and Creating Stored Procedures 600
Using Stored Procedures 600
Creating Stored Procedures 609
Lesson 29 Triggers 623
Understanding Triggers 623
AFTER Triggers 624
INSTEAD OF Triggers 625
Creating Triggers 626
Using the CREATE TRIGGER Command 626
Using the UPDATE Function 632
Using the Inserted and Deleted Tables 634
Lesson 30 User-Defined Functions 639
Understanding User-Defined Functions 639
Scalar Functions 640
Table-Valued Functions 640
Creating User-Defined Functions 641
Creating Scalar Functions 642
Creating Table-Valued Functions 644
Using User-Defined Functions 648
Using User-Defined Functions in Transact-SQL Statements 649
Using User-Defined Functions in Table Definitions 652
Glossary 659
Index 665
Read More Show Less

Customer Reviews

Average Rating 1.5
( 4 )
Rating Distribution

5 Star

(0)

4 Star

(0)

3 Star

(0)

2 Star

(1)

1 Star

(3)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing all of 4 Customer Reviews
  • Anonymous

    Posted February 1, 2005

    Not Worth The Money

    I am fairly new to SQL 2000 and thought this book would help. If you like just doing the steps without an explanation of what your doing or why then this is the book for you. Some of the steps leave you hanging as to where you go. The pictures in the book do not always look like the one you see in front of you in SQL and the entries do not always work. Lesson 17 is a real pain to get through without trying to figure out what was left out of the step to get the query to run. As I said if you just want to copy examples and not really understand why your entering the info go for it but it is not worth the almost $50.00 for the book. If I had not opened the cd that comes with the book I would be returning it for my money.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted December 3, 2003

    Worthless

    This book is nothing more than a collection of screen shots with no explanation of the underlying concepts being presented.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted February 26, 2003

    Poor

    I would agree with the above mentioned review. This book is simply a 'cookbook' and their is no mention as to WHY you do something. I would NOT recommend this book nor the author for someone who wants to learn SQL 2000.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted November 20, 2001

    Weak

    This is one of the worst Step by Step books I've bought. It is full of 'filler' pages designed to bulk up the book. It still moves through instructions to open a table in design view or return all rows view after 20 chapters. In addition, there are NO explanations of WHY you are doing something. The author just tells you to type commands in the SQL view screen but never tells you why the command did what it did. I have had great success with other Step by Step books by different authors but I would advise to stay away from this one!!

    Was this review helpful? Yes  No   Report this review
Sort by: Showing all of 4 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)