Inside Microsoft SQL Server 2005: T-SQL Querying comments and corrections (920141)



The information in this article applies to:

  • Inside Microsoft SQL Server 2005: T-SQL Querying, ISBN 0-7356-2313-9

SUMMARY

This article contains comments, corrections, and information about known errors relating to the Microsoft Press book Inside Microsoft SQL Server 2005: T-SQL Querying, 0-7356-2313-9.

The following topics are covered:

  • Page 8: Correction to table keys
  • Page 20: <table_expression> tag used in place of <right_table_expression> tag
  • Page 81: Missing spaces in Table 3-3
  • Page 137: Ordered scan referenced rather than unordered scan
  • Page 140: The second orderid should be 120 in the sixth sentence of the paragraph following the query
  • Page 158: The term "grows larger" is used instead of the term "gets lower"
  • Page 162: The third line from the top needs UNIQUE removed and orderdate replacing orderid
  • Pages 163-166: Unordered Nonclustered Index Scan referred to as Unordered Covering Nonclustered Index Scan
  • Page 173: Customer information referenced rather than session information
  • Page 173: Listing 3-7 table name should be BigSessions instead of sessions
  • Page 192: Correction in fourth paragraph subquery example instructions
  • Page 203: Variable b referenced in place of variable c
  • Page 272: "ranking functions" and "recursive queries" referred to rather than "PIVOT" and "UNPIVOT"
  • Page 340: Yearly Quantities refered to rather than Yearly Orders in the caption for Table 6-16
  • Page 364: Incorrect labels for the second and third columns of Table 6-24
  • Page 364: Incorrect labels for the second and third columns of Table 6-25
  • Pages 431 and 432: #CustStage referred to rather than #CustsStage
  • Page 434: usp_AsyncSec refered to rather than usp_AsyncSeq
  • Page 445: Incorrect SET statement in the first code sample
  • Page 480: fn_subordinates2 referenced in place of fn_subordinates1
  • Page 513: Reference to Table 9-35 should be more specific
  • Page 562: Lamp 36 missing from the list of lamps that are on
  • Page 567: Corretion to Puzzle 19 answer

MORE INFORMATION

Page 8: Correction to table keys

On page 8, at the bottom of sidebar, there is an error.

Change:

"On the other hand, UNIQUE and PRIMARY KEY constraints, sorting, and grouping treat NULLs as equal: You cannot insert into a table two rows with a NULL in a column that has a UNIQUE or PRIMARY KEY constraint defined on it."

To:

"On the other hand, a UNIQUE constraint, sorting, and grouping treat NULLs as equal: You cannot insert into a table two rows with a NULL in a column that has a UNIQUE constraint defined on it."

Page 20: <table_expression> tag used in place of <right_table_expression> tag

On page 20, the second line of the second table operator reads:

{CROSS | OUTER} APPLY <table_expression>


It should read:

{CROSS | OUTER} APPLY <right_table_expression>


Page 81: Missing spaces in Table 3-3

On page 81, the items in the "counter_name" column read:

"Buffercachehitratio
Buffer cache hit ratio base
Pagelookups/sec
Freeliststalls/sec
Freepages
Totalpages
Targetpages
Databasepages
Reservedpages
Stolenpages"

They should read:

"Buffer cache hit ratio
Buffer cache hit ratio base
Page lookups/sec
Free list stalls/sec
Free pages
Total pages
Target pages
Database pages
Reserved pages
Stolen pages"

Page 137: Ordered scan referenced rather than unordered scan

On page 137, the third sentence on the page reads:

"With no fragmentation at all, the performance of an ordered scan of an index should be very close to the performance of an ordered scan, because both will end up reading the data physically in a sequential manner."

It should read:

"With no fragmentation at all, the performance of an ordered scan of an index should be very close to the performance of an unordered scan, because both will end up reading the data physically in a sequential manner."

Page 140: The orderid should be 120 in the sixth sentence of the paragraph following the query

On page 140, in the paragraph following the query, sentence 6 reads:

"The second part of the access method is an ordered partial scan in the leaf level from the first key in the range until the last (orderid = 101)."

It should read:

"The second part of the access method is an ordered partial scan in the leaf level from the first key in the range until the last (orderid = 120)."

Page 158: The term "grows larger" is used instead of the term "gets lower"

On page 158, the second sentence of the paragraph after figure 3-49 reads:

"As the selectivity of the query grows larger, the more substantial the cost is of the lookups here."

It should read:

"As the selectivity of the query gets lower (low selectivity = high percentage of rows), the more substantial the cost is of the lookups here."

Page 162: The third line from the top needs UNIQUE removed and orderdate replacing orderid

On page 162, the 3rd line from the top reads:

"CREATE UNIQUE CLUSTERED INDEX idx_cl_od ON dbo.Orders(orderid);"

It should read:

"CREATE CLUSTERED INDEX idx_cl_od ON dbo.Orders(orderdate);"

Pages 163-166: Unordered Nonclustered Index Scan referred to as Unordered Covering Nonclustered Index Scan

On page 163, the first cell in the second and third rows of Table 3-16 read:

"Unordered Covering Nonclustered Index Scan

Unordered Covering Nonclustered Index Scan + Lookups"

They should read:

"Unordered Nonclustered Index Scan

Unordered Nonclustered Index Scan + Lookups"

On page 164, the second and third items on the left-hand side of the key for Figure 3-55 read:

"Unordered Covering Nonclustered Index Scan

Unordered Covering Nonclustered Index Scan + Lookups"

They should read:

"Unordered Nonclustered Index Scan

Unordered Nonclustered Index Scan + Lookups"

On page 164, the first cell in the second and third rows of Table 3-17 read:

"Unordered Covering Nonclustered Index Scan

Unordered Covering Nonclustered Index Scan + Lookups"

They should read:

"Unordered Nonclustered Index Scan

Unordered Nonclustered Index Scan + Lookups"

On page 165, the second and third items on the left-hand side of the key for Figure 3-56 read:

"Unordered Covering Nonclustered Index Scan

Unordered Covering Nonclustered Index Scan + Lookups"

They should read:

"Unordered Nonclustered Index Scan

Unordered Nonclustered Index Scan + Lookups"

On page 166, the labels for the second and third columns in Figure 3-57 read:

"Unordered Covering Nonclustered Index Scan

Unordered Covering Nonclustered Index Scan + Lookups"

They should read:

"Unordered Nonclustered Index Scan

Unordered Nonclustered Index Scan + Lookups"

Page 173: Customer information referenced rather than session information

On page 173, the second sentence in the second paragraph reads:

"Ideally, you should be thinking about the number of customers, the number of different order dates, and so on."

It should read:

"Ideally, you should be thinking about realistic distribution of session start times, session duration, and so on."

Page 173: Listing 3-7 table name should be BigSessions instead of sessions

On page 173, the caption of Listing 3-7 reads:

"Populate sessions with inadequate sample data"

It should read:

"Populate BigSessions with inadequate sample data"

Page 192: Correction in fourth paragraph subquery example instructions

On page 192, the fourth paragraph subquery example instructions reads:

"For example, run the following code three times: once as shown, a second time with LIKE N'Kollar' in place of LIKE N'Davolio', and a third time with LIKE N'D%:"

It should read:

"For example, run the following code three times: once as shown, a second time with LIKE N'Kollar' in place of LIKE N'Davolio', and a third time with LIKE N'D%':"

Page 203: Variable b referenced in place of variable c

On page 203, the third sentence on the page reads:

"The predicate b NOT IN(a, b, NULL) therefore returns NOT UNKNOWN, which equals UNKNOWN, and customer c is not returned by the query, either, even though c does not appear in the customer list."

It should read:

"The predicate c NOT IN(a, b, NULL) therefore returns NOT UNKNOWN, which equals UNKNOWN, and customer c is not returned by the query, either, even though c does not appear in the customer list."

Page 272: "ranking functions" and "recursive queries" referred to rather than "PIVOT" and "UNPIVOT"

On page 272, the first sentence of the Note at the bottom of the page reads:

"Changing the compatibility mode of a database to an earlier version will prevent you from using the new language elements (for example, ranking functions, recursive queries, and so on)."

It should read:

"Changing the compatibility mode of a database to an earlier version will prevent you from using the new language elements (for example, PIVOT, UNPIVOT, and so on)."

Page 340: Yearly Quantities refered to rather than Yearly Orders in the caption for Table 6-16

On page 340, the caption for Table 6-16 reads:

"Count of Yearly Quantities per Customer"

It should read:

"Count of Yearly Orders per Customer"

Page 364: Incorrect labels for the second and third columns of Table 6-24

On page 364, the column labels for Table 6-24:

"groupid agg_or agg_or_binval"

They should read:

"groupid agg_and agg_and_binval"

Page 364: Incorrect labels for the second and third columns of Table 6-25

On page 364, the column labels for Table 6-25 read:

"groupid agg_or agg_or_binval"

They should read:

"groupid agg_xor agg_xor_binval"

Pages 431 and 432: #CustStage referred to rather than #CustsStage

On page 431, the seventh and eigth sentences of the final paragraph read:

"The UPDATE makes a single pass over the rows in #CustStage. With every row that the UPDATE visits, it stores the value of @key + 1 in KeyCol and in @key. This means that with every new row visited, @key is incremented by one and stored in KeyCol. You basically distribute the new block of sequence values among the rows in #CustStage."

They should read:

"The UPDATE makes a single pass over the rows in #CustsStage. With every row that the UPDATE visits, it stores the value of @key + 1 in KeyCol and in @key. This means that with every new row visited, @key is incremented by one and stored in KeyCol. You basically distribute the new block of sequence values among the rows in #CustsStage."

On page 432, the first sentence on the page reads:

"this code after resetting the sequence value to 0, as instructed earlier, #CustStage will contain seven UK customers, with KeyCol values ranging from 1 through 7."

It should read:

"this code after resetting the sequence value to 0, as instructed earlier, #CustsStage will contain seven UK customers, with KeyCol values ranging from 1 through 7."

On page 432, the first sentence of the second paragraph reads:

"The specialized T-SQL UPDATE statement is not standard and doesn't guarantee it will access the rows in #CustStage in any particular order."

It should read:

"The specialized T-SQL UPDATE statement is not standard and doesn't guarantee it will access the rows in #CustsStage in any particular order."

Page 434: usp_AsyncSec refered to rather than usp_AsyncSeq

On page 434, the second sentence after the Note box reads:

"The rollback prevents the AsyncSeq table from growing. In fact, it will never contain any rows from calls to usp_AsyncSec."

It should read:

"The rollback prevents the AsyncSeq table from growing. In fact, it will never contain any rows from calls to usp_AsyncSeq."

Page 445: Incorrect SET statement in the first code sample

On page 445, the last two lines of the first code sample reads:

	WHERE C.CustomerID = dbo.Orders.CustomerID);
WHERE C.Country = 'USA';


They should read:

	WHERE C.CustomerID = dbo.Orders.CustomerID);
WHERE CustomerID IN
  (SELECT CustomerID FROM dbo.Customers WHERE Country = 'USA');


Page 480: fn_subordinates2 referenced in place of fn_subordinates1

On page 480, the last sentence before Listing 9-8 reads:

"Run the code in Listing 9-8 to create the fn_subordinates2 function, which is a revision of fn_subordinates2 that also supports a level limit."

It should read:

"Run the code in Listing 9-8 to create the fn_subordinates2 function, which is a revision of fn_subordinates1 that also supports a level limit."

Page 513: Reference to Table 9-35 should be more specific

On page 513, the first two full sentences on the page read:

"For each request, I'll provide a sample query followed by its output (shown in Table 9-35). Return the subtree with a given root:"

It should read:

"For each request, I'll provide a sample query followed by its output. Return the subtree with a given root, generating the output shown in Table 9-35:"

Page 562: Lamp 36 missing from the list of lamps that are on

On page 562, the first sentence of the answer to Puzzle 10 reads:

"All the lamps are off except for lamps number 1, 4, 9, 16, 25, 49, 64, 81, and 100, which are on."

It should read:

"All the lamps are off except for lamps number 1, 4, 9, 16, 25, 36, 49, 64, 81, and 100, which are on."

Page 567: Corretion to Puzzle 19 answer

On page 567, under "Puzzle 19: Find the pattern in the Sequence", in last sentence, the first number in the sequence - 4 - was added by mistake.

Change:

"Here's the first part of the sequence with a few additional numbers: 4, 3, 3, 5, 4, 4, 3, 5, 5, 4, 3, 6, 6, 8, 8, 7, 7, 9, 8, 8, 6, 9, 9, 11, 10, 10, 9, 11, 11, 10, ."

To:

"Here's the first part of the sequence with a few additional numbers: 3, 3, 5, 4, 4, 3, 5, 5, 4, 3, 6, 6, 8, 8, 7, 7, 9, 8, 8, 6, 9, 9, 11, 10, 10, 9, 11, 11, 10, ."

Microsoft Press is committed to providing informative and accurate books. All comments and corrections listed above are ready for inclusion in future printings of this book. If you have a later printing of this book, it may already contain most or all of the above corrections.

Modification Type:MinorLast Reviewed:9/14/2006
Keywords:KB920141